7988 Commits

Author SHA1 Message Date
Luca Barbato
9314af3b2e matroskadec: request a read buffer for the wav header
Solve an infiniloop.

CC: libav-stable@libav.org

(cherry picked from commit 37cb3b180a1dc3d6f123f68e0806585ebc2578b6)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
8829c79039 oggdec: make sure the private parse data is cleaned up
(cherry picked from commit d894f74762bc95310ba23f804b7ba8dffc8f6646)

Related to CVE-2012-2882

Conflicts:

	libavformat/oggdec.h
	libavformat/oggparsevorbis.c
2013-03-09 18:54:27 +01:00
Luca Barbato
03fec31cd7 oggdec: free the ogg streams on read_header failure
Plug an annoying memory leak on broken files.
(cherry picked from commit 89b51b570daa80e6e3790fcd449fe61fc5574e07)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 42bd6d9cf681306d14c92af97a40116fe4eb2522)

Conflicts:

	libavformat/oggdec.c
2013-01-12 17:59:41 +01:00
Luca Barbato
6eebba08e1 oggdec: check memory allocation
(cherry picked from commit ba064ebe48376e199f353ef0b335ed8a39c638c5)

Conflicts:

	libavformat/oggdec.c
2013-01-12 17:59:41 +01:00
Dale Curtis
9ded14fcb8 Fix uninitialized reads on malformed ogg files.
The ogg decoder wasn't padding the input buffer with the appropriate
FF_INPUT_BUFFER_PADDING_SIZE bytes. Which led to uninitialized reads in
various pieces of parsing code when they thought they had more data than
they actually did.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit ef0d779706c77ca9007527bd8d41e9400682f4e4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Martin Storsjö
d1d329932f rtsp: Recheck the reordering queue if getting a new packet
If we timed out and consumed a packet from the reordering queue,
but didn't return a packet to the caller, recheck the queue status.
Otherwise, we could end up in an infinite loop, trying to consume
a queued packet that has already been consumed.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8729698d50739524665090e083d1bfdf28235724)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
d282e5ce72 lavf: avoid integer overflow in ff_compute_frame_duration()
Scaling the denominator instead of the numerator if it is too large
loses precision. Fixes an assert caused by a negative frame duration in
the fuzzed sample nasa-8s2.ts_s202310.

CC: libav-stable@libav.org
(cherry picked from commit 7709ce029a7bc101b9ac1ceee607cda10dcb89dc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +01:00
Diego Biurrun
01a4e7f623 lavf: Bump minor version to distinguish branch and master version numbers
This enables checking for an API version not present in master that
has avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
2013-01-10 20:51:45 +01:00
Anton Khirnov
3750104e9d id3v2: fix reading unsynchronized frames.
Current code would incorrectly process e.g. 'ff 00 ff 00 ff' to
'ff ff ff', while it should be 'ff ff 00 ff'.

Fixes Bug 395.

CC: libav-stable@libav.org
(cherry picked from commit 9ae80e6a9cefcab61e867256ba19ef78a4bfe0cb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Luca Barbato
abe345251a yuv4mpeg: reject unsupported codecs
The muxer already rejects unsupported pixel formats, reject also
unsupported codecs to prevent dangerous misuses.
(cherry picked from commit 424b1e764263b1493de4c34365ef367ddae856db)

Conflicts:

	libavformat/yuv4mpeg.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:34:08 +01:00
Anton Khirnov
d792be5681 yuv4mpeg: return proper error codes.
Fixes Bug 373.

CC:libav-stable@libav.org
(cherry picked from commit d3a72becc6371563185a509b94f5daf32ddbb485)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Anton Khirnov
5acd1c6561 avidec: return 0, not packet size from read_packet().
(cherry picked from commit eeade678f0a2bac127aeed2fb68d8717a6463420)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:21 +02:00
Anton Khirnov
15c2e8027f wav: do not fail on empty INFO tags
Fixes Bug 379

CC: libav-stable@libav.org
2012-10-16 20:20:55 +02:00
Anton Khirnov
0582b8e3ea avidec: use actually read size instead of requested size
Fixes CVE-2012-2788
(cherry picked from commit 0af49a63c7f87876486ab09482d5b26b95abce60)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
7124fa5d36 lavf: don't segfault when a NULL filename is passed to avformat_open_input()
This can easily happen when the caller is using a custom AVIOContext.

Behave as if the filename was an empty string in this case.

CC: libav-stable@libav.org
(cherry picked from commit a5db8e4a1a5449cc7a61e963c9fa698a4f22131b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:39 +02:00
Mans Rullgard
2fb4be9a99 mov: set AVCodecContext.width/height for h264
This is required for correct cropping of files from Canon
cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 8aa93e900449c88c3169ff5636fed03f41779cac)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-10 11:22:57 +02:00
Ronald S. Bultje
ec27262c4d ea: check chunk_size for validity.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 273e6af47b38391f2bcc157cca0423fe7fcbf55c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-03 19:05:29 +02:00
Ronald S. Bultje
a08cb950b2 mov: don't overwrite existing indexes.
Prevents all kind of badness if files contain multiple
indexes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4f7c7624c0db185c48c59d95d745ab3f7851a5b4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Alex Converse
86bd0244ec mov: Do not read past the end of the ctts_data table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 86f2ae06b92d42580ae7ebd86d52c9b7acbc2f13)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Alex Converse
15de658c04 xwma: Validate channels and bits_per_coded_sample.
This prevents a SIGFPE later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5023b89bba198b2f8e43b7f555aeb9c30d33db9f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
19d3f7d8ac asf: reset side data elements on packet copy.
Prevents crash (double free) when free()ing the original packet.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e73c6aaabff1169899184c382385fe9afae5b068)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Anton Khirnov
989431c02f id3v2: fix skipping extended header in id3v2.4
In v2.4, the length includes the length field itself.
(cherry picked from commit ddb4431208745ea270dce8fce4cba999f0ed4303)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-01 19:30:21 +02:00
Ronald S. Bultje
c3bf08d04c smacker: error out if palette copy-with-offset overruns palette size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a93b572ae4f517ce0c35cf085167c318e9215908)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:12:00 +01:00
Justin Ruggles
4a15240a27 mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
(cherry picked from commit 3798205a77ce275613098ecb48645e6029811f14)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:54 +01:00
Alex Converse
fb049da952 mov: Add more HDV and XDCAM FourCCs.
Reference: VLC
(cherry picked from commit b142496c5630b9bc88fb9eaccae7f6bd62fb23e7)
2012-03-06 15:31:49 -08:00
Alex Converse
4a325ddeae mov: Add support for MPEG2 HDV 720p24 (hdv4)
(cherry picked from commit 0ad522afb3a3b3d22402ecb82dd4609f7655031b)
2012-03-06 15:31:41 -08:00
Alex Converse
035dd77cbb dv: Fix small overread in audio frequency table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 0ab3687924457cb4fd81897bd39ab3cc5b699588)
2012-03-06 15:28:01 -08:00
Alex Converse
ce14f00dea movdec: Avoid av_malloc(0) in stss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 29a20ac4a19df5acc0eef306ca5a737778a31358)
2012-03-06 15:28:01 -08:00
Alex Converse
3e8434bcea dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936.
Found with asan.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 2d1c0dea5f6b91bec7f5fa53ec050913d851e366)
2012-03-06 15:28:01 -08:00
Michael Niedermayer
efd30c4d95 dv: Fix null pointer dereference due to ach=0
dv: Fix null pointer dereference due to ach=0

Fixes part2 of CVE-2011-3929

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Roman Shaposhnik <roman@shaposhnik.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 5a396bb3a66a61a68b80f2369d0249729bf85e04)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
d7fddc97d4 dv: check stype
dv: check stype

Fixes part1 of CVE-2011-3929
Possibly fixes part of CVE-2011-3936

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Roman Shaposhnik <roman@shaposhnik.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 635bcfccd439480003b74a665b5aa7c872c1ad6b)
2012-03-06 15:28:00 -08:00
Alex Converse
dd37038ac7 nsvdec: Propagate errors
Related to CVE-2011-3940.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit c898431ca5ef2a997fe9388b650f658fb60783e5)

Conflicts:

	libavformat/nsvdec.c
2012-03-06 15:28:00 -08:00
Alex Converse
e410dd1792 nsvdec: Be more careful with av_malloc().
Check results for av_malloc() and fix an overflow in one call.

Related to CVE-2011-3940.

Based in part on work from Michael Niedermayer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 8fd8a48263ff1437f9d02d7e78dc63efb9b5ed3a)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
ffdc41f039 nsvdec: Fix use of uninitialized streams.
Fixes CVE-2011-3940 (Out of bounds read resulting in out of bounds write)

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

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 6a89b41d9780325ba6d89a37f2aeb925aa68e6a3)
2012-03-06 15:28:00 -08:00
Alex Converse
b7c8fff803 mpegts: Do not call read_sl_header() when no bytes remain in the buffer.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4df369692ea8aee7094ac0f233cef8d1bee139a3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Alex Converse
3f7e90cf0c mpegts: Pad the packet buffer in handle_packet().
This allows it to be used with get_bits without the thread of overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1aa708988ac131cf7d5c8bd59aca256a7c974df9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
9686a2c2cf matroska: check buffer size for RM-style byte reordering.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9c239f6026a170866a4a0c96908980ac2cfaa8b3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
40ccc81146 asf: don't seek back on EOF.
Seeking back on EOF will reset the EOF flag, causing us to re-enter
the loop to find the next marker in the ASF file, thus potentially
causing an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bb6d5411e1e1a8e0608b1af1c4addee654dcbac5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:22:35 +01:00
Ronald S. Bultje
1c63d61372 asf: error out on ridiculously large minpktsize values.
They cause various issues further down in demuxing.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6e57a02b9f639af53acfa9fc742c1341400818f8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:21:57 +01:00
Anton Khirnov
2ad77c60ef lavf: add functions for accessing the fourcc<->CodecID mapping tables.
Fixes bug 212.
(cherry picked from commit dd6d3b0e025cb2a16022665dbb8ab1be18dc05e8)

Conflicts:

	doc/APIchanges

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-29 10:44:37 +01:00
Ronald S. Bultje
71a939fee4 oma: don't read beyond end of leaf_table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 934cd18a43151ba4b819d9270d539cdb26f6e079)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 22:10:55 +01:00
Ronald S. Bultje
abe3572878 rm: prevent infinite loops for index parsing.
Specifically, prevent jumping back in the file for the next index, since
this can lead to infinite loops where we jump between indexes referring
to each other, and don't read indexes that don't fit in the file.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit aac07a7a4c2c7a4a29cf6dbc88c1b9fdd191b99d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:04:04 +01:00
Ronald S. Bultje
4f48417fe7 swf: check return values for av_get/new_packet().
Prevents crashers when using the packet if allocation failed.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 31632e73f47d25e2077fce729571259ee6354854)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
0312969b9e rmdec: when using INT4 deinterleaving, error out if sub_packet_h <= 1.
We read sub_packet_h / 2 packets per line of data (during deinterleaving),
which equals zero if sub_packet_h <= 1, thus causing us to not read any
data, leading to an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e30b3e59a4f3004337cb1623b2aac988ce52b93f)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
f947e965be asf: prevent packet_size_left from going negative if hdrlen > pktlen.
This prevents failed assertions further down in the packet processing
where we require non-negative values for packet_size_left.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 41afac7f7a67c634c86b1d17fc930e9183d4aaa0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
5c365dc979 aiff: don't skip block_align==0 check on COMM-after-SSND files.
This prevents SIGFPEs when using block_align for divisions.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 32a659c758bf2ddd8ad48f18c06fa77444341286)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
d16653c3d4 lavf: prevent infinite loops while flushing in avformat_find_stream_info
If no data was seen for a stream decoder are returning 0 when fed with
empty packets for flushing. We can stop flushing when the decoder does
not return delayed delayed frames anymore. Changes try_decode_frame()
return value to got_picture or negative error.

CC: libav-stable@libav.org
(cherry picked from commit b3461c29c1aee7d62eeb02a59d46593c60362679)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
183e0eb5b9 matroska: don't overwrite string values until read/alloc was succesful.
This prevents certain tags with a default value assigned to them (as per
the EBML syntax elements) from ever being assigned a NULL value. Other
parts of the code rely on these being non-NULL (i.e. they don't check for
NULL before e.g. using the string in strcmp() or similar), and thus in
effect this prevents crashes when reading of such specific tags fails,
either because of low memory or because of targeted file corruption.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cd40c31ee9ad2cca6f3635950b002fd46be07e98)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
be0b3137d0 matroskadec: Pad AAC extradata.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

CC: libav-stable@libav.org
(cherry picked from commit d2ee8c17793201ce969afd1f433ba1580c143cd2)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Anton Khirnov
571a4cf273 lavc: set AVCodecContext.codec in avcodec_get_context_defaults3().
This way, if the AVCodecContext is allocated for a specific codec, the
caller doesn't need to store this codec separately and then pass it
again to avcodec_open2().

It also allows to set codec private options using av_opt_set_* before
opening the codec.
(cherry picked from commit bc901998487bf9b77a423961d9f961bcc28a9291)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00