Commit Graph

14013 Commits

Author SHA1 Message Date
Andreas Cadhalpun 86c024ea9e avformat/flvenc: check that the codec_tag fits in the available bits
flags is later written with avio_w8 and if it doesn't fit in one byte it
triggers an av_assert2.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e8565d21c2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-28 23:00:55 +01:00
Andreas Cadhalpun 8a9d5a8140 avformat/bit: only accept the g729 codec and 1 channel
Other codecs/channel numbers are not supported by this muxer.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d0b8640f75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-26 23:28:01 +01:00
Andreas Cadhalpun 81196b6d60 avformat/bit: check that pkt->size is 10 in write_packet
Ohter packet sizes are not supported by this muxer.

This avoids a null pointer dereference of pkt->data.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eeda2c3de8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-26 23:27:12 +01:00
Andreas Cadhalpun cd74b344c2 avformat/adxdec: check avctx->channels for invalid values
This avoids a null pointer dereference of pkt->data.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7faa40af98)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-26 21:02:13 +01:00
Michael Niedermayer 94ebfef2fb avformat/omadec: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0f55bc29d4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 21:14:32 +01:00
Michael Niedermayer f8b6ba5574 avformat/vqf: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cb08687180)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 21:14:15 +01:00
Michael Niedermayer 3b17f32ec3 avformat/mvdec: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 26c0cc154e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 20:49:51 +01:00
Michael Niedermayer 1480d9b3d3 avformat/gxf: Use 64bit for res to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 12987f8900)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 20:30:26 +01:00
Michael Niedermayer 1aea2213a6 avformat/idcin: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d1923d15a3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 20:30:11 +01:00
Michael Niedermayer 07a55344e6 avformat/thp: Check av_get_packet() for failure not only for partial output
Fixes null pointer dereference
Fixes: signal_sigsegv_db2c1f_3108_cov_163322880_pikmin2_opening1_partial.thp

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2579dbb4b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 04:30:36 +01:00
Michael Niedermayer af0544ca3d avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 05e1619529)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 15:08:32 +01:00
wm4 55b75ece70 avformat/mpc8: fix broken pointer math
This could overflow and crash at least on 32 bit systems.

Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b737a2c528)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 01:05:26 +01:00
wm4 28f303542e avformat/mpc8: fix hang with fuzzed file
This can lead to an endless loop by seeking back a few bytes after each
attempted chunk read. Assuming negative sizes are always invalid, this
is easy to fix. Other code in this demuxer treats negative sizes as
invalid as well.

Fixes ticket #4262.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 56cc024220)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-04 00:48:43 +01:00
wm4 6e7f183ae6 avformat/tta: fix crash with corrupted files
av_add_index_entry() can fail, for example because the parameters are
invalid, or because memory allocation fails. Check this; it can actually
happen with corrupted files.

The second hunk is just for robustness. Just in case functions like
ff_reduce_index() remove entries. (Not sure if this can actually
happen.)

Fixes ticket #4294.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6a0cd529a3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 16:18:19 +01:00
Michael Niedermayer 6862970dbf avformat/omadec: fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1f7f5903a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 20:32:13 +01:00
Michael Niedermayer 633ce6baaa avformat/smacker: Fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 465f3705b1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-01 20:23:30 +01:00
Michael Niedermayer 201d626bb9 avformat/matroskadec: Fix number suffixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc3cdb00d0)

Conflicts:

	libavformat/matroskadec.c
2015-02-01 20:22:17 +01:00
Michael Niedermayer e651a2f88c avformat/utils: Fix number suffixes in tb_unreliable()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b15bba2ae)

Conflicts:

	libavformat/utils.c
2015-02-01 20:15:22 +01:00
Michael Niedermayer 7c54f14168 avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03abf55f25)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-18 00:27:57 +01:00
Michael Niedermayer 36ac584548 avformat/mov: Fix mixed declaration and statement warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db27f50e06)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 20:37:57 +01:00
Michael Niedermayer fa0194e9ca avformat/utils: Clear pointer in ff_alloc_extradata() to avoid leaving a stale pointer in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bbfca8e84b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 16:10:46 +01:00
Michael Niedermayer 83700aced1 avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e70e4aca5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 16:09:32 +01:00
Dale Curtis 13d4d8a9c6 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>
(cherry picked from commit 3ebd76a9c5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 05:49:08 +01:00
Michael Niedermayer 71d0cfff15 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>
(cherry picked from commit 3859868c75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 05:49:07 +01:00
Dale Curtis 6832b1fde7 mov: Avoid overflow with mov_metadata_raw()
The code previously added 1 to len without checking its size,
resulting in an overflow which can corrupt value[-1] -- which
may be used to store unaligned ptr information for certain
allocators.

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 04:21:06 +01:00
Michael Niedermayer bfdf15943d avformat/flvdec: Increase string array size
Fixes parsing httphostheader of Scarlatti\,\ Pieter-Jan\ Belder\ -\ Sonata\ K113\ in\ A\ major\ -\ Alle.flv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eb767a276b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-01 18:37:57 +01:00
Michael Niedermayer fbc998ce3f avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream
Such data streams (which then contain no other packets except the faulty one)
confuse some user applications, like VLC
Works around vlcticket 12389

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 322f0f5960)

Conflicts:

	libavformat/flvdec.c
2015-01-01 18:37:56 +01:00
Michael Niedermayer 41802887eb avformat/cdxl: Fix integer overflow of image_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3eb5cbe0c5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-31 22:39:31 +01:00
Stefano Sabatini 67e2394cc6 lavf/segment: remove duplicated and inconsistent cleanup code in seg_write_packet()
In particular, avoid to leave around the seg->avf pointer to freed
structure, and fix crash with:
ffmpeg -f lavfi -i testsrc -c:v h264 -map 0 -f segment foo-%d.ts
(cherry picked from commit 169065fbfb)

Found-by: Qinghao Tang
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-30 15:38:21 +01:00
Michael Niedermayer a736171b69 avformat/mov: Fix memleaks for duplicate STCO/CO64/STSC atoms
Also see [FFmpeg-devel] [PATCH] avformat/mov: strengthen some table allocations
which contains more fixes but is unfinished

Fixes: signal_sigabrt_7ffff6ac7bb9_3484_cov_1830000177_starfox2.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1b5d112406)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-30 15:38:21 +01:00
Michael Niedermayer 07a37001a3 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>
(cherry picked from commit caa7a3914f)

Conflicts:

	libavformat/isom.h

Conflicts:

	libavformat/isom.h
2014-12-30 15:38:20 +01:00
Michael Niedermayer 844f7f78aa avformat/aviobuf: Check that avio_seek() target is non negative
Fixes out of array access

Suggested-by: Andrew Scherkus <scherkus@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ed86dbd05d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-30 15:38:20 +01:00
wm4 68b6a5efbf avformat/matroskadec: fix handling of recursive SeekHead elements
When matroska_execute_seekhead() is called, it goes through the list of
seekhead entries and attempts to read elements not read yet. When doing
this, the parser can find further SeekHead elements, and will extend the
matroska->seekhead list. This can lead to a (practically) infinite loop
with certain broken files. (Maybe it can happen even with valid files.
The demuxer doesn't seem to check correctly whether an element has
already been read.)

Fix this by ignoring elements that were added to the seekhead field
during executing seekhead entries.

This does not fix the possible situation when multiple SeekHead elements
after the file header (i.e. occur after the "before_pos" file position)
point to the same elements. These elements will probably be parsed
multiple times, likely leading to bugs.

Fixes ticket #4162.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6551acab68)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-30 15:38:20 +01:00
Michael Niedermayer 80ba4b5d45 avformat/rmdec: Check codec_data_size
Fixes infinite loop
Fixes Ticket4154

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a6f730730b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-30 15:38:20 +01:00
Clément Bœsch ea1d0bc029 avformat/rsd: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.

(cherry picked from commit edbbb11488)
2014-12-19 18:03:05 -03:00
Michael Niedermayer c4034e4e19 avformat/hlsenc: Free context after hls_append_segment
Fixes reading uninitialized memory

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 530eb6acf8)

Conflicts:

	libavformat/hlsenc.c
(cherry picked from commit 0ac22f043bee2f1c4daf5e1044b014326325d929)

Conflicts:

	libavformat/hlsenc.c
(cherry picked from commit 134d3e1c0331462ea94c78a5e13a63b20d283653)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:53:11 +01:00
Michael Niedermayer ea61dfe0ab avformat/mpegts: Check desc_len / get8() return code
Fixes out of array read
Fixes: signal_sigsegv_844d59_10_signal_sigsegv_a17bb7_366_mpegts_mpeg2video_mp2_dvbsub_topfield.rec

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c3d7f00ee3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:53:10 +01:00
Benoit Fouet dc319a52f9 avformat/riffenc: Filter out "BottomUp" in ff_put_bmp_header()
Fixes Ticket1304

Commit message and extradata size bugfix by commiter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6843b9dc78)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Katerina Barone-Adesi 36ec1c2c55 apetag: Fix APE tag size check
The size variable is (correctly) unsigned, but is passed to several functions
which take signed parameters, such as avio_read, sometimes after having
numbers added to it. So ensure that size remains within the bounds that
these functions can handle.

CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit c5560e72d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Michael Niedermayer 5bd45a1b27 avformat/m4vdec: Check for non startcode 00 00 00 sequences in probe
Fixes miss detection of PCM as m4v
Fixes Ticket 3928

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7c1835c52a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Michael Niedermayer 72f0d13802 avformat/swfdec: Do not change the pixel format
This is currently not supported
Fixes part of Ticket 3539

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c2430304df)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Michael Niedermayer 255ebf3aff avformat/swfdec: Use side data to communicate w/h changes to the decoder
Fixes reading from freed data
Fixes part of Ticket3539

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1c55d0ff32)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a9734e7d3017ffc9539eaac2a8acce3ad427f746)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Mika Raento cb10e05ff0 segment: don't access outside seg->frames array
Fixes wrong number of segments output and undefined memory access.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 58e0402e02)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
wm4 17f30ab6a1 oggdec: fix invalid free on error
The read_packet callback passes a pointer to a stack-allocated AVPacket.
Attempting to free it with av_free() makes no sense.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b173f5c155)

Conflicts:

	libavformat/oggdec.c
(cherry picked from commit a82401b7284e05e2cf6fb89aeed53738af06a7fd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:37 +01:00
Michael Niedermayer 72149fcb1b avformat/tee: flip assigment direction
Found-by: CSA
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2e6fdcb7f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 18:44:36 +01:00
Michael Niedermayer 2d0b2db27e avformat/avidec: fix handling dv in avi
Fixes Ticket4086

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0ae0354d3)
2014-11-21 10:23:35 +01:00
James Almer fc82ba06ee avformat/oggparseopus: Check opus_duration() return value
Regression since 39d11d599c

os->pduration would be wrongly assigned a negative value on invalid packets
instead of aborting.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c619e14c31)
2014-09-11 19:37:05 -03:00
Michael Niedermayer 64908f70e4 avformat/oggparseopus: calculate pts/dts for initial packets after seeking
based on code from oggparsevorbis
Fixes Ticket3124
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7f39352a1b)

Fixes ticket #3943.
2014-09-11 23:50:35 +02:00
Michael Niedermayer 6f6b1d0ddb avformat/oggparseopus: factor opus_duration() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 39d11d599c)
2014-09-11 23:50:05 +02:00
Michael Niedermayer eb1e5cf818 avformat/dv: implement fallback in dv_extract_pack()
Fixes Ticket2340
Fixes Ticket2341

Based-on mail from Dave Rice <dave@dericed.com>
Tested-by: Dave Rice <dave@dericed.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 88f038ac97)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-17 16:00:25 +02:00