Commit Graph

1094 Commits

Author SHA1 Message Date
Michael Niedermayer
4d1b017c38 avformat/mov: Check av_add_index_entry() return value
Fixes NULL pointer dereference
Fixes: signal_sigsegv_b060e0_3794_cov_1293954059_vc1-wmapro.ism

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-23 22:48:35 +01:00
Kevin Wheatley
fb3fb1d0d4 avformat/mov: Add simple ACLR atom reading to set the color range of the incomming track for codec's like DNxHD that utilise AVID's proprietary atom.
On input ACLR will be used to set colour range no matter which codec
it is associated with.
No change for when it will be output.

Rework mov_read_extradata function to allow detection of truncated
atom reads by callers.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-19 15:42:55 +01:00
Michael Niedermayer
38e641a060 avformat/mov: Bypass av_add_index_entry()
The new mov code uses a temporally non sorted index since 4abfa387b8
and can thus no longer be filled with av_add_index_entry() which expects the index to be sorted.
Reverting 4abfa387b8 and this commit would be
a alternative fix as would be various other options.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-16 01:30:47 +01:00
Michael Niedermayer
f9e76d66e9 Merge commit '4abfa387b8234736f6e0e541951e3d5eb60eb843'
* commit '4abfa387b8234736f6e0e541951e3d5eb60eb843':
  mov: Change DTS-based seek into CTS-based seek.

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-16 01:28:02 +01:00
Yusuke Nakamura
4abfa387b8 mov: Change DTS-based seek into CTS-based seek.
CTS-based seek is reasonable since player requests frames in output order
not coded order.

This change fixes seek to a keyframe within consecutive keyframes.
Let's say P[0|-1] and P[1|0], here x and y inside [x|y] are PTS and DTS
respectively, and both two frames are a keyframe. If you try to seek on
PTS=0, i.e. P[0|-1], you'll get P[1|0] if the demuxer is DTS based. This
is obviously undesirable.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-15 21:26:04 +02:00
Diego Biurrun
36cf8eb448 mov: Fix compilation with DEBUG enabled 2015-02-14 10:45:16 -08:00
Michael Niedermayer
ad1549aec3 avformat/mov: print a warning if parsing udta failed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 13:02:24 +01:00
Michael Niedermayer
849ad5175b avformat/mov: Heuristically detect raw udta
Fixes tkhd+moov fragment provided by koda

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-13 04:30:29 +01:00
Michael Niedermayer
5763f67502 avformat/mov: Check dimensions before setting aspect
Fixes division by 0
Fixes: asan_heap-uaf_143f420_728_cov_1441472032_HDV_0113.MP4

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-09 14:52:15 +01:00
Michael Niedermayer
a83e0639c0 Merge commit 'e3528d2a7bf29ba148d7ac1678552ce0089cd14f'
* commit 'e3528d2a7bf29ba148d7ac1678552ce0089cd14f':
  mov: Implement parsing of the "HandlerName" from the MP4 HDLR atom

Conflicts:
	libavformat/mov.c

See: b76bc01034
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 22:19:46 +01:00
Hendrik Leppkes
e3528d2a7b mov: Implement parsing of the "HandlerName" from the MP4 HDLR atom
This atom typically is used for a track title. The handler name is stored
as a Pascal string in the QT specs (first byte is the length of the string),
so do not export it.

A second length check based on the first character is added to avoid
overwriting an already specified handler_name (it happens with YouTube
videos for instance, the handler_name get masked), or specifying an
empty string metadata.

The Pascal string fix and the second length check are written
by Clément Bœsch <clement.boesch@smartjog.com>.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-03 15:15:12 +00:00
Michael Niedermayer
ed91c8651a avformat/mov: simplify pasp value before setting SAR
This avoids a 65536:65536 SAR

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 14:11:20 +01:00
Paul B Mahol
cc1357a173 avformat/mov: remove unneeded #include, there are no assert()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-31 08:57:07 +00:00
Michael Niedermayer
6d34665c76 Merge commit '32125781487411ed3b1b28b32063d6cd4024d4fc'
* commit '32125781487411ed3b1b28b32063d6cd4024d4fc':
  mov: export audio service type as side data

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-27 18:32:23 +01:00
Anton Khirnov
3212578148 mov: export audio service type as side data 2015-01-27 09:21:28 +01:00
Vittorio Giovara
4c5fa628da mov: Do not compute negative SAR values
This partially reverts cf70ba37ba, since
it didn't take into account when rotation is 0, but there is another
valid operation (eg. translation) in the matrix.

Found-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-23 14:54:59 +00:00
Jon Morley
47372caac5 libavformat/mov.c: Handle timecode from tmcd atom in counter mode
When the timecode value is in counter mode then it is important to use
the timescale and frameduration to calculate the timecode fps.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-23 13:14:15 +01:00
Michael Niedermayer
e32b07aea4 avformat/mov: Stricter sanity checks on the display_matrix
Fixes "broken" tkhd
Found-by: koda
Tested-by: koda
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-22 19:52:52 +01:00
Michael Niedermayer
cc18ea8de0 avformat/mov: Do not set aspect ratios that would contain zeros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:26:16 +01:00
Michael Niedermayer
47795505ac avformat/mov: rewrite aspect from matrix code
The original code was intended purely for rotation == 0
In cf70ba37ba the condition was
changed to use it only for rotation != 0
which broke the cases for which it was intended to be used
as well as breaking cases for which it was not intended to be
used.
This changes the code so it could work for the more general
case and fixes the regressions
If you have sample files that are not handled correctly
please open tickets or mail me!

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:22:00 +01:00
Michael Niedermayer
89b6382bec Merge commit 'cf70ba37ba74089a18295b29e77dead0a3222c9e'
* commit 'cf70ba37ba74089a18295b29e77dead0a3222c9e':
  mov: Check angle rather than full matrix when updating SAR

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 04:00:51 +01:00
Vittorio Giovara
cf70ba37ba mov: Check angle rather than full matrix when updating SAR
When the display matrix is not the identity one, but the rotation angle
is zero, there is no need to update the sample aspect ratio.

Otherwise, it is possible to obtain negative values which interferes
with transcoding in later stages. This kind of behaviour is reproducible
on mov files with "major_brand: MSNV".

CC: libav-stable@libav.org
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-01-14 17:17:23 +01:00
Carl Eugen Hoyos
a5334d4081 Handle r10k endianess atom DpxE.
Fixes playback and remuxing of r10k_full-range_big-endian.mov.

Reported, analyzed and tested by Olaf Matthes, olaf matthes gmx de
2015-01-11 12:15:03 +01:00
Michael Niedermayer
07e4ed5637 avformat/mov: Use avio_closep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-08 20:19:20 +01:00
Michael Niedermayer
383c6a3a07 avformat/mov: use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 15:07:50 +01:00
Michael Niedermayer
62eafb6a0d avformat/mov: Clear array to prevent potential out of array read from av_dlog()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 15:07:50 +01:00
Dale Curtis
3ebd76a9c5 mov: Fix negative size calculation in mov_read_default().
The previous code assumed if an atom was marked with a 64-bit
size extension, it actually had that data available. The new
code verfies there's enough data in the atom for this to be
done.

Failure to verify causes total_size > atom.size which will
result in negative size calculations later on.

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 05:23:45 +01:00
Michael Niedermayer
3859868c75 avformat/mov: fix integer overflow in mov_read_udta_string()
Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 04:44:16 +01:00
Dale Curtis
db42d93a61 mov: Fix overflow and error handling in read_tfra().
Under abnormal conditions the item_count may exceed the max
allocation size on 32-bit systems, this causes the allocated
size to overflow and become too small for the given count.

Additionally, if av_reallocp() fails its allocation, the
fragment_index_count is not correctly decremented.

Ensuring further havoc may be wrought, the error code for
read_tfra() is not checked upon return.

Found-by: Paul Mehta <paul@paulmehta.com>

positive return code and use of _array functions by commiter

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 04:44:16 +01:00
Clément Bœsch
11201bbf7f avformat/mov: reindent after previous commit 2015-01-02 11:38:28 +01:00
Clément Bœsch
55faf56c72 avformat/mov: move edit list heuristics into mov_build_index()
mov_read_elst() is now only responsible from storing the table in a data
structure; this is consistent with other table readers functions.
2015-01-02 11:38:21 +01:00
Michael Niedermayer
24af050c2f Merge commit '64f7575fbd64e5b65d5c644347408588c776f1fe'
* commit '64f7575fbd64e5b65d5c644347408588c776f1fe':
  mov: avoid a memleak when multiple stss boxes are present

Conflicts:
	libavformat/mov.c

See: 5ab882d728
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 12:31:52 +01:00
Anton Khirnov
64f7575fbd mov: avoid a memleak when multiple stss boxes are present
CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-12-19 08:01:46 +01:00
Thomas Volkert
00d7555f34 wavdec: RIFX file format support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-18 00:10:35 +01:00
Michael Niedermayer
be9ce6e10a avformat/mov: fix integer overflow of size
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 23:37:25 +01:00
Michael Niedermayer
caa7a3914f avformat/mov: check atom nesting depth
Fixes call stack overflow
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 23:37:24 +01:00
Michael Niedermayer
1a86e29ff0 Merge commit '6f4364aba9d70dc5fd9f1c88b9c03bf9ea893d40'
* commit '6f4364aba9d70dc5fd9f1c88b9c03bf9ea893d40':
  mov: Fix handling of zero-length metadata values

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-16 02:23:43 +01:00
Martin Storsjö
6f4364aba9 mov: Fix handling of zero-length metadata values
Since 3cec81f4d4, a zero-length metadata value would try to
allocate 2*0 bytes, where av_malloc() returns NULL.

Always add one to the allocated length, to allow space for
a null terminator in the zero-length case.

Incidentally, this fixes fate-alac on RVCT 4.0, where a compiler
bug seems to mess up the mov muxer to the point that it writes
the wrong sort of metadata. Previously this bug was undetected,
but since 3cec81f4d4 such mov files started returning
AVERROR(ENOMEM) in the mov demuxer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-15 23:42:10 +02:00
Michael Niedermayer
d7de48f0df avformat/mov: Simplify code by using OFFSET() and FLAGS macros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-13 15:06:19 +01:00
Michael Niedermayer
e2829a8175 avformat/mov: Disable XMP metadata by default
This was suggested by cbsrobot, ubitux and koda

There are files with huge amounts of XMP data, which would otherwise
be displayed in the terminal output of FFmpeg

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-11 21:47:37 +01:00
Michael Niedermayer
99bf26fc6b Merge commit '3c01039e0bc7d269900e15551f8171c4328a0223'
* commit '3c01039e0bc7d269900e15551f8171c4328a0223':
  mov: further expand the list of parsed metadata tags

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 11:50:48 +01:00
Michael Niedermayer
885e74622e Merge commit 'e2e07dbaab1f17e995842b7eacec4665d44c3d14'
* commit 'e2e07dbaab1f17e995842b7eacec4665d44c3d14':
  mov: expand the list of parsed metadata tags

Conflicts:
	libavformat/mov.c

See: 543f3db978
See: dadf668df2
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 23:16:43 +01:00
Michael Niedermayer
0dcebe2620 Merge commit 'b704b648f9ecb830874627db958a37e004107d1b'
* commit 'b704b648f9ecb830874627db958a37e004107d1b':
  mov: parse XMP metadata on demand

Conflicts:
	libavformat/isom.h
	libavformat/version.h

See: 054c506e3d

The default is left unchanged at enabled
We can change the default if people prefer but i do not want to do that
in a merge.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 22:59:16 +01:00
Michael Niedermayer
420aebf0c5 Merge commit '174c5fde90060faab67796a5eaef742630f1db6e'
* commit '174c5fde90060faab67796a5eaef742630f1db6e':
  mov: parse @PRM and @PRQ metadata tags

Conflicts:
	libavformat/mov.c

See: f540851ce3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 22:14:29 +01:00
Michael Niedermayer
82f0f0482e Merge commit '35384934d6e27e0334060a23a0c83a3cb5cef198'
* commit '35384934d6e27e0334060a23a0c83a3cb5cef198':
  mov: cosmetics: reorder the list of tags

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 21:59:08 +01:00
Dave Rice
3c01039e0b mov: further expand the list of parsed metadata tags
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-12-08 14:28:16 +00:00
Vittorio Giovara
e2e07dbaab mov: expand the list of parsed metadata tags
Based on L-Smash code by Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>.
2014-12-08 14:28:09 +00:00
Vittorio Giovara
b704b648f9 mov: parse XMP metadata on demand
The Extensible Metadata Platform tag can contain various kind of data
which are not strictly related to the video file, such as history of edits
and saves from the project file. So display XMP metadata only when the
user explicitly requires it.

Based on a patch by Marek Fort <marek.fort@chyronhego.com>.
2014-12-08 13:53:30 +00:00
Vittorio Giovara
174c5fde90 mov: parse @PRM and @PRQ metadata tags
These tags describe the product and quicktime library version respectively.
They originate from Adobe Premiere, but also some other programs use them.
Contrary to other tags, they contain 'raw' data which is not to be
interpreted as iso639 or mac strings.

Based on a patch by Peter Ross <pross@xvid.org>.
2014-12-08 13:53:20 +00:00
Vittorio Giovara
35384934d6 mov: cosmetics: reorder the list of tags
Alphabetically order the list by the tag to facilitate the insertion of
new ones.
2014-12-08 13:53:10 +00:00