465 Commits

Author SHA1 Message Date
Michael Niedermayer
31b697f19c Merge commit '6222ee068eeb3d29a2bcc4a89ce31effdef5a061' into release/1.1
* commit '6222ee068eeb3d29a2bcc4a89ce31effdef5a061':
  matroskadec: Fix read-after-free in matroska_read_seek()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-10 13:11:26 +01:00
Xiaohan Wang
6222ee068e matroskadec: Fix read-after-free in matroska_read_seek()
In matroska_read_seek(), |tracks| is assigned at the begining of the
function. However, functions like matroska_parse_cues() could reallocate
the tracks and invalidate |tracks|.

This assigns |tracks| only before using it, so that it will not get
invalidated elsewhere.

Bug-Id: chromium/427266
2015-01-27 14:36:12 +00:00
wm4
437e50b3d6 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 6551acab6877addae815decd02aeca33ba4990c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-21 04:40:35 +01:00
Anton Khirnov
cbf51c4d36 matroskadec: pad EBML_BIN data.
It might be passed to code requiring padding, such as lzo decompression.

Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit 30be1ea33e5525266ad871bed60b1893a53caeaf)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-01-05 17:13:19 -05:00
Aurelien Jacobs
3e089e8f71 matroskadec: use correct compression parameters for current track CodecPrivate
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8b516f154a0a08655cec2d13d12aadc58cae0b1c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-01-05 16:49:15 -05:00
Michael Niedermayer
8ffdcd04c4 avformat/matroskadec: only set r_frame_rate if the value is within reasonable limits
Fixes Ticket2451

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6853e40106cac769f0641183ea0bdd530ae9a0a1)
2013-10-24 11:14:37 +02:00
Michael Niedermayer
af26185bdc Merge commit '163196562fe744149ef599d754c30c08a9898381' into release/1.1
* commit '163196562fe744149ef599d754c30c08a9898381':
  oggparseogm: Convert to use bytestream2
  rv34: Check the return value from ff_rv34_decode_init
  matroskadec: Verify realaudio codec parameters
  mace: Make sure that the channel count is set to a valid value
  svq3: Check for any negative return value from ff_h264_check_intra_pred_mode
  vp3: Check the framerate for validity
  cavsdec: Make sure a sequence header has been decoded before decoding pictures
  vocdec: Don't update codec parameters mid-stream
  sierravmd: Do sanity checking of frame sizes
  omadec: Properly check lengths before incrementing the position
  mpc8: Make sure the first stream exists before parsing the seek table

Conflicts:
	libavcodec/mace.c
	libavformat/oggparseogm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-08 00:49:18 +02:00
Martin Storsjö
9f7a8b8f8f matroskadec: Verify realaudio codec parameters
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 569d18aa9dc989c37bb4d4b968026fe5afa6fff9)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-04 03:26:25 +02:00
Michael Niedermayer
dfe0ba46bf Merge commit 'aade60ab165716523788cd11caf03ae61b40144a' into release/1.1
* commit 'aade60ab165716523788cd11caf03ae61b40144a':
  matroskadec: Check that .lang was allocated and set before reading it
  alac: Limit max_samples_per_frame
  ape demuxer: check for EOF in potentially long loops
  4xm: check that bits per sample is strictly positive
  lavf: avoid integer overflow when estimating bitrate
  pictordec: pass correct context to avpriv_request_sample

Conflicts:
	libavcodec/pictordec.c
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-07 13:49:23 +02:00
Martin Storsjö
aade60ab16 matroskadec: Check that .lang was allocated and set before reading it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5bcd3ae5b167fb74215520b01d5d810e0c8986ab)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-07 10:18:59 +02:00
Michael Niedermayer
7043e435dd Merge remote-tracking branch 'jamrial/release/1.1' into release/1.1
* jamrial/release/1.1:
  avformat/matroskadec: check out_samplerate before using it in av_rescale()
  matroskadec: Improve TTA duration calculation
  matroskaenc: simplify mkv_check_tag()
  lavf/matroskaenc: Check for valid metadata before creating tags

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-28 23:18:46 +02:00
Michael Niedermayer
f7fcd40e63 matroska_read_seek: Fix used streams for subtitle index compensation
Might fix Ticket1907 (I have no testcase so i cant test)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-28 22:58:52 +02:00
Michael Niedermayer
40b8e7f168 avformat/matroskadec: check out_samplerate before using it in av_rescale()
Prevent assertion failure with damaged input

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 338f8b2eaf36f078eb5cc26ac10e651dc4c48243)
2013-08-26 17:52:49 -03:00
James Almer
77783c7114 matroskadec: Improve TTA duration calculation
Calculate the duration as accurately as possible to improve decoding of samples
where the last frame is smaller than the rest.

Signed-off-by: James Almer <jamrial@gmail.com>
Approved-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit af248fa1174200acb537a6ab1198bb2fed38e884)
2013-08-25 19:41:55 -03:00
Michael Niedermayer
ae72abf652 avformat/matroskadec: Detect conflicting sample rate/default_duration
Fixes Ticket2508

Thanks-to: Moritz Bunkus
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6158a3bcdf52fafc1d9ae9eb358a56c614b23aa3)
2013-07-16 11:50:37 +02:00
Michael Niedermayer
63235b8d41 Merge commit '858864d350320dd807e349bda017026e61a47fe0' into release/1.1
* commit '858864d350320dd807e349bda017026e61a47fe0':
  xmv: check audio track parameters validity.
  bmv: check for len being valid in bmv_decode_frame().
  xmv: do not leak memory in the error paths in xmv_read_header()
  matroska: pass the lace size to the matroska_parse_rm_audio

Conflicts:
	libavformat/matroskadec.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-12 13:19:54 +02:00
Michael Niedermayer
5353bd0285 Merge commit 'b90816d94b0b5c01f451ff98cfbf1d5ddec9c3c1' into release/1.1
* commit 'b90816d94b0b5c01f451ff98cfbf1d5ddec9c3c1':
  matroska: Update the available size after lace parsing

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-12 13:09:24 +02:00
Michael Niedermayer
065996b984 Merge commit '05015d03da1d745bb92915b5cea92dec16af719f' into release/1.1
* commit '05015d03da1d745bb92915b5cea92dec16af719f':
  matroska: fix a corner case in ebml-lace parsing
  avfiltergraph: check for sws opts being non-NULL before using them.
  configure: Enable hwaccels without external dependencies by default.
  oma: Validate sample rates

Conflicts:
	libavfilter/avfiltergraph.c
	libavfilter/graphparser.c
	libavformat/oma.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-12 12:49:36 +02:00
Reimar Döffinger
2922ab7e6f matroska: set "done" only during resync fail.
Fixes playback of test7.mkv validation test file.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit 762d4335aec2e5299a06bfbce15d21336af19464)
2013-05-07 10:55:11 +02:00
Luca Barbato
09e391abd8 matroska: pass the lace size to the matroska_parse_rm_audio
Each lace must be independent according to the specification.

Fix heap-buffer-overflow in matroska_parse_block for
corrupted real media in mkv files.

Stricter check than fc43c19a567aa945398dccb491d972c11ec2a065

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-06 11:40:05 +02:00
Dale Curtis
b90816d94b matroska: Update the available size after lace parsing
Fix heap-buffer-overflow in matroska_parse_block for
corrupted real media in mkv files.

CC: libav-stable@libav.org

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-06 11:39:39 +02:00
Luca Barbato
05015d03da matroska: fix a corner case in ebml-lace parsing
Make sure we notice when the lace_size[n] is a negative value.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-06 11:39:28 +02:00
Michael Niedermayer
76477c3843 Merge remote-tracking branch 'qatar/release/9' into release/1.1
* qatar/release/9:
  libx264: use the library specific default rc_initial_buffer_occupancy
  lavc: set the default rc_initial_buffer_occupancy
  lavc: introduce the convenience function init_get_bits8
  lavc: check for overflow in init_get_bits
  APIchanges: Fill in missing hashes and dates; fix a version number typo.
  configure: enable pic for shared libs on AArch64
  zmbv: Reset the decoder on keyframe errors
  vc1dec: prevent a crash due missing pred_flag parameter
  matroska: Fix use after free
  vp3: Fix double free in vp3_decode_end()
  update Changelog
  oggdec: make sure the private parse data is cleaned up
  oggdec: free the ogg streams on read_header failure
  update Changelog
  x86: lavr: use the x86inc.asm automatic stack alignment in mixing functions
  Prepare 9.1 Release

Conflicts:
	Changelog
	RELEASE
	doc/APIchanges
	libavcodec/utils.c
	libavformat/oggdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 04:26:42 +01:00
Dale Curtis
ca2e3f1131 matroska: Fix use after free
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ae3d41636942cbc0236bad21ad06c65f4eb0f096)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-11 02:17:19 +01:00
Michael Niedermayer
d0b450457b matroskadec: fix ffio_init_context() usage
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:01:30 +01:00
Michael Niedermayer
5e1bacf2d4 matroskadec: reset size when freeing data.
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-04 03:50:09 +01:00
Michael Niedermayer
0efcf16a3e replace av_log(0, by av_log(NULL,
The first parameter is a pointer and NULL is more correct

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-23 18:10:02 +01:00
Michael Niedermayer
c2ca0163af matroskadec: check h in generic rm packet shuffler
Fixes crash

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-11 01:19:44 +01:00
Michael Niedermayer
c63e76ba35 ebml_read_binary: use fast_padded_malloc()
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-09 23:35:58 +01:00
Michael Niedermayer
2581d9bcbb Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doc: add apidoc target for doxygen API documentation
  matroskadec: do not use avpacket internals

Conflicts:
	doc/Makefile
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-03 14:48:51 +01:00
Anton Khirnov
34871beb5e matroskadec: do not use avpacket internals 2012-11-02 18:28:56 +01:00
Michael Niedermayer
aa604e8e33 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avutil: Make LZO decoder code configure-time selectable
  avutil: Move memcpy_backptr() to mem.c
  configure: detect parisc64 automatically
  configure: detect ppc64 automatically
  configure: detect mips64 automatically
  configure: generalise 64-bit test
  smoothstreamingenc: Don't assume streams start from timestamp 0

Conflicts:
	configure
	libavutil/Makefile
	libavutil/lzo.c
	libavutil/lzo.h
	libavutil/mem.c
	libavutil/mem.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 13:15:58 +02:00
Diego Biurrun
2a91ada828 avutil: Make LZO decoder code configure-time selectable 2012-10-25 11:49:49 +02:00
Michael Niedermayer
2c5b92fe90 matroskadec: fix double negation typo
Fixes CID602563
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-20 16:58:33 +02:00
Michael Niedermayer
1116491c53 matroska_parse_rm_audio: check for malloc failure
Fixes CID733712
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-20 16:55:45 +02:00
Michael Niedermayer
9270a2b374 Merge commit '4c995fafd861f537360b3717901cdbed6a6844e7'
* commit '4c995fafd861f537360b3717901cdbed6a6844e7':
  configure: simplify get_version() function
  build: support asan and tsan toolchain shortcuts
  rmdec: Move SIPR code shared with Matroska demuxer to a separate file

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-16 13:20:46 +02:00
Diego Biurrun
7e68c91e24 rmdec: Move SIPR code shared with Matroska demuxer to a separate file 2012-10-15 13:34:07 +02:00
Michael Niedermayer
406cdddbdd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libx264: add forgotten ;
  matroskadec: fix a sanity check.
  matroskadec: only return corrupt packets that actually contain data
  lavf: zero data/size of the packet passed to read_packet().
  ARM: use 2-operand syntax for ADD Rd, PC in Apple PIC code
  ARM: align PIC offset pools to 4 bytes
  ARM: swap source operands in some add instructions
  configure: update tms470 detection for latest version
  lavf probe: prevent codec probe with no data at all seen
  motion_est: fix use of inline on extern functions

Conflicts:
	libavcodec/motion_est_template.c
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-21 14:44:32 +02:00
Anton Khirnov
87b017a298 matroskadec: fix a sanity check. 2012-09-21 09:15:07 +02:00
Anton Khirnov
bdb939ad73 matroskadec: only return corrupt packets that actually contain data
Fixes bug 372.
2012-09-21 09:15:01 +02:00
Michael Niedermayer
a6ec1e49f6 matroskadec: matroska_parse_rm_audio: remove unused parameter
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 23:43:20 +02:00
Michael Niedermayer
5864ce13d1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mp3dec: read Xing frame TOC index
  mp3dec: use named constants for Xing header flags
  libx264: add support for nal-hrd, required for Blu-ray streams.
  mov: support random access point grouping
  matroskadec: properly support BlockDuration

Conflicts:
	libavcodec/libx264.c
	libavformat/isom.h
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 21:46:35 +02:00
Michael Niedermayer
8c51ea5489 Merge commit 'c831ebf61629d219ebcaa9f02d262e67aad09d83'
* commit 'c831ebf61629d219ebcaa9f02d262e67aad09d83':
  matroskadec: split frame parsing
  matroskadec: split laces parsing

Conflicts:
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 20:39:47 +02:00
Michael Niedermayer
b8044972c4 Merge commit '117d8c6d1f1c187ffc6098d9618457e00534e013'
* commit '117d8c6d1f1c187ffc6098d9618457e00534e013':
  matroska: implement support for ProRes
  matroska: implement support for ALAC

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 19:43:38 +02:00
Michael Niedermayer
0da50055eb matroskadec: fix typo
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 19:12:07 +02:00
Michael Niedermayer
6902c3acb0 Merge commit '870e75524aa0d00ebcd1d15589c8d29b84af1565'
* commit '870e75524aa0d00ebcd1d15589c8d29b84af1565':
  matroskadec: validate lace_size when parsed

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 19:11:46 +02:00
Michael Niedermayer
a16c512374 Merge commit 'c9a39cec70603f662f4c326b21b11c4f0112079a'
* commit 'c9a39cec70603f662f4c326b21b11c4f0112079a':
  matroskadec: return meaningful errors in matroska_decode_buffer
  matroskadec: fix incorrect unsigned->signed conversion

Conflicts:
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 13:40:47 +02:00
Michael Niedermayer
1df2e3c707 Merge commit '8d4dd55c37b14ecea596f3477b35bf6c20688d8b'
* commit '8d4dd55c37b14ecea596f3477b35bf6c20688d8b':
  matroskadec: refactor matroska_decode_buffer

Conflicts:
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 13:32:43 +02:00
Michael Niedermayer
61ced71d79 Merge commit '581281e242609a222233a2e5538b89dfb88fb18e'
* commit '581281e242609a222233a2e5538b89dfb88fb18e':
  matroskadec: check realloc in lzo encoding
  matroska: honor error_recognition on unknown doctypes
  tiffdec: Add support for GRAY16LE.
  tiffenc: Add support for little endian RGB48 and GRAY16
  mpeg4: support frame parameter changes with frame-mt
  mpegvideo: check ff_find_unused_picture() return value for errors
  mpegvideo: release frame buffers before freeing them
  configure: msvc: default to 'lib' as 'ar' tool
  build: support some non-standard ar variants

Conflicts:
	libavcodec/h263dec.c
	libavcodec/mpegvideo.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 03:20:29 +02:00
Luca Barbato
c831ebf616 matroskadec: split frame parsing 2012-09-19 20:34:14 +02:00