Compare commits

...

1145 Commits

Author SHA1 Message Date
Michael Niedermayer
79bc4798b7 MAINTAINERS: Remove myself as leader
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f2c58931e6)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-31 18:35:38 +02:00
Michael Niedermayer
d6541bdbd7 Update for 0.10.16
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:06:09 +01:00
Andreas Cadhalpun
fcabfc5590 roqvideoenc: set enc->avctx in roq_encode_init
So far it is only set in roq_encode_frame, but it is used in
roq_encode_end to free the coded_frame. This currently segfaults if
roq_encode_frame is not called between roq_encode_init and
roq_encode_end.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
25e2ef355d avcodec/tiff: move bpp check to after "end:"
This ensures that all current and future code-pathes get bpp checked

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

Conflicts:

	libavcodec/tiff.c
2015-03-12 18:03:50 +01:00
Michael Niedermayer
7f99fae1ec avcodec/utils: Align YUV411 by as much as the other YUV variants
Fixes out of array accesses
Fixes: ffmpeg_mjpeg_crash2.avi

Found-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Tested-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e3201c38d5)

Conflicts:

	libavcodec/utils.c
2015-03-12 18:03:50 +01:00
Andreas Cadhalpun
6739df26a6 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-03-12 18:03:50 +01:00
Andreas Cadhalpun
f92e8cccf5 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-03-12 18:03:50 +01:00
Dyami Caliri
c89645c3ef Fix buffer_size argument to init_put_bits() in multiple encoders.
Several encoders were multiplying the buffer size by 8, in order to get
a bit size. However, the buffer_size argument is for the byte size of
the buffer. We had experienced crashes encoding prores (Anatoliy) at
size 4096x4096.
(cherry picked from commit 50833c9f7b)

Conflicts:

	libavcodec/proresenc_kostya.c

Conflicts:

	libavcodec/faxcompr.c
	libavcodec/s302menc.c

Conflicts:

	libavcodec/adpcmenc.c
2015-03-12 18:03:50 +01:00
Michael Niedermayer
0c1f8a784d avcodec/zmbv: Check len before reading in decode_frame()
Fixes out of array read
Fixes: asan_heap-oob_4d4eb0_3994_cov_3169972261_zmbv_15bit.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
07a9a43d5c avcodec/snowdec: Fix ref value check
Fixes integer overflow and out of array read.
Fixes: signal_sigsegv_24169e6_3445_cov_3778346427_snow_chroma_bug.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Andreas Cadhalpun
7232fc75e1 avcodec/a64multienc: fix use of uninitialized values in to_meta_with_crop
Averaging over 2 pixels doesn't work correctly for the last pixel, because the
rest of the buffer is not initialized.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
3d023f4343 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>
(cherry picked from commit f8be605800b801e59ea49657a560287883ebfc8a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
4640184c76 avcodec/mjpegdec: Skip blocks which are outside the visible area
Fixes out of array accesses
Fixes: ffmpeg_mjpeg_crash.avi

Found-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 08509c8f86)

Conflicts:

	libavcodec/mjpegdec.c
(cherry picked from commit 0bb0716d9c0699895abcef2d3954c1d6e4157cb2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
20d95a8ad3 avcodec/h264_ps: More completely check the bit depths
Fixes out of array read
Fixes: asan_static-oob_30328b6_719_cov_3325483287_H264_artifacts_motion.h264

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

Conflicts:

	libavcodec/h264_ps.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
3b90117a1f 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-03-12 18:03:50 +01:00
Michael Niedermayer
a16669f1e2 avcodec/mjpegdec: Check number of components for JPEG-LS
Fixes out of array accesses
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

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

Conflicts:

	libavcodec/mjpegdec.c
2015-03-12 18:03:50 +01:00
Michael Niedermayer
5c0413aa85 avcodec/mjpegdec: Check escape sequence validity
Fixes assertion failure
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:50 +01:00
Michael Niedermayer
d0a925ba2e 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-03-12 18:03:49 +01:00
wm4
e83c03aaf1 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)

Conflicts:

	libavformat/mpc8.c
(cherry picked from commit 49dd89f902)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
wm4
376533e0cd 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-03-12 18:03:49 +01:00
Michael Niedermayer
1d73ad25dc 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-03-12 18:03:49 +01:00
Michael Niedermayer
c00fd60ab3 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
(cherry picked from commit e651a2f88c)
2015-03-12 18:03:49 +01:00
Michael Niedermayer
c78ed1fb5d avcodec/flac_parser: fix handling EOF if no headers are found
Fixes assertion failure
Fixes Ticket4269

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
wm4
00cde0cddc avcodec/dvdsubdec: error on bitmaps with size 0
Attemtping to decode them could lead to invalid writes with some fuzzed
samples.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Johan Andersson
b3242c0f22 cmdutils: update copyright year to 2015.
(cherry picked from commit 3e16065221)

Conflicts:

	cmdutils.c
2015-03-12 18:03:49 +01:00
Michael Niedermayer
766c1cbeb4 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-03-12 18:03:49 +01:00
wm4
ce219702c3 avcodec/dvdsubdec: fix out of bounds accesses
The code blindly trusted buffer offsets read from the file in the RLE
decoder. Explicitly check the offset. Also error out on other RLE
decoding errors.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
87a716991d avcodec/indeo3: ensure offsets are non negative
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 368642361f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
cd4827dfd4 avcodec/indeo3: use signed variables to avoid underflow
Fixes out of array read
Fixes: signal_sigsegv_1b0a4da_1865_cov_2167818389_computer_anger.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3305acdc92)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
1d1cc267e6 swscale: increase yuv2rgb table headroom
Fixes out of array access
Fixes: case2_bad_read_yuv2rgbx32.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
87ec3c6156 avcodec/vmdvideo: Check len before using it in method 3
Fixes out of array access
Fixes: asan_heap-oob_4d23ba_91_cov_3853393937_128.vmd

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

Conflicts:

	libavcodec/vmdav.c
2015-03-12 18:03:49 +01:00
Michael Niedermayer
adf2f2166e 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>
2015-03-12 18:03:49 +01:00
wm4
39a6977354 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>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
5a1061b4ad swscale/x86/rgb2rgb_template: fix crash with tiny size and nv12 output
Fixes Ticket4151

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
a5c43d7c87 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>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
0b5d644839 avcodec/pngdec: Check IHDR/IDAT order
Fixes out of array access
Fixes: asan_heap-oob_20a6c26_2690_cov_3434532168_mail.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 79ceaf827b)

Conflicts:

	libavcodec/pngdec.c
2015-03-12 18:03:49 +01:00
Michael Niedermayer
aebfcf7d62 avcodec/mjpegdec: Fix context fields becoming inconsistent
Fixes out of array access
Fixes: asan_heap-oob_1ca4f85_2760_cov_144449187_miss_congeniality_pegasus_ljpg.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0eecf40935)

Conflicts:

	libavcodec/mjpegdec.c
(cherry picked from commit 32d3acac727f3f4a6489ca129a5ea4ccdfcb34a5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
ec640e10b2 avcodec/wmaprodec: Fix integer overflow in sfb_offsets initialization
Fixes out of array read
Fixes: asan_heap-oob_2aec5b0_1828_classical_22_16_2_16000_v3c_0_exclusive_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5dcb99033d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
3296e30d37 avcodec/h264_slice: Clear table pointers to avoid stale pointers
Might fix Ticket3889

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

Conflicts:

	libavcodec/h264_slice.c

Conflicts:

	libavcodec/h264.c
2015-03-12 18:03:49 +01:00
Michael Niedermayer
d327f673f9 avcodec/dnxhddec: treat pix_fmt like width/height
Fixes out of array accesses
Fixes: asan_heap-oob_22c9a39_16_015.mxf
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f3c0e0bf6f)

Conflicts:

	libavcodec/dnxhddec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:49 +01:00
Michael Niedermayer
017226fdf9 avcodec/dxa: check dimensions
Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e70312dfc2)

Conflicts:

	libavcodec/dxa.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
27d82d8374 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>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
e0ed766f2a avcodec/qpeg: fix off by 1 error in MV bounds check
Fixes out of array access
Fixes: asan_heap-oob_153760f_4_asan_heap-oob_1d7a4cf_164_VWbig6.avi

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
677da72300 avcodec/pngdec: Calculate MPNG bytewidth more defensively
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e830902934)

Conflicts:

	libavcodec/pngdec.c
2015-03-12 18:03:48 +01:00
Michael Niedermayer
7238c744de avcodec/pngdec: Check bits per pixel before setting monoblack pixel format
Fixes out of array accesses
Fixes: asan_heap-oob_14dbfcf_4_asan_heap-oob_1ce5767_179_add_method_small.png

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

Conflicts:

	libavcodec/pngdec.c
2015-03-12 18:03:48 +01:00
Michael Niedermayer
7c1150bf05 avcodec/tiff: more completely check bpp/bppcount
Fixes pixel format selection
Fixes out of array accesses
Fixes: asan_heap-oob_1766029_6_asan_heap-oob_20aa045_332_cov_1823216757_m2-d1d366d7965db766c19a66c7a2ccbb6b.tif

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

Conflicts:

	libavcodec/tiff.c
(cherry picked from commit e9125e74897135d690cf44f6e6d39e80dcd07803)

Conflicts:

	libavcodec/tiff.c
2015-03-12 18:03:48 +01:00
Michael Niedermayer
19d0c9e993 avcodec/mmvideo: Bounds check 2nd line of HHV Intra blocks
Fixes out of array access
Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm

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

Conflicts:

	libavcodec/mmvideo.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
bd3a28e8b6 avcodec/utils: Add case for jv to avcodec_align_dimensions2()
Fixes out of array accesses
Fixes: asan_heap-oob_12304aa_8_asan_heap-oob_4da4f3_300_intro.jv

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

Conflicts:

	libavcodec/utils.c
2015-03-12 18:03:48 +01:00
Michael Niedermayer
bb6a8a0509 avcodec/mjpegdec: check bits per pixel for changes similar to dimensions
Fixes out of array accesses
Fixes: asan_heap-oob_16668e9_2_asan_heap-oob_16668e9_346_miss_congeniality_pegasus_mjpg.avi

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

Conflicts:

	libavcodec/mjpegdec.c
(cherry picked from commit 94371a404c663c3dae3d542fa43951567ab67f82)

Conflicts:

	libavcodec/mjpegdec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
1704a7b67d avcodec/jpeglsdec: Check run value more completely in ls_decode_line()
previously it could have been by 1 too large
Fixes out of array access
Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8c1e3.jls
Fixes: asan_heap-oob_12240f5_1_asan_heap-oob_12240f5_448_t8nde0.jls
Fixes: asan_heap-oob_12240fa_1_asan_heap-oob_12240fa_448_t16e3.jls

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Reimar Döffinger
ef803afa76 configure: add noexecstack to linker options if supported.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(cherry picked from commit b7082d953f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
348b87b9bd avcodec/ac3enc_template: fix out of array read
Found-by: Andreas Cadhalpun
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d85ebea3f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
ced4e9fdbb 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>
2015-03-12 18:03:48 +01:00
Michael Niedermayer
7248e73559 avcodec: fix aac/ac3 parser bitstream buffer size
Buffers containing copies of the AAC and AC3 header bits were not padded
before parsing, violating init_get_bits() buffer padding requirement,
leading to potential buffer read overflows.
This change adds FF_INPUT_BUFFER_PADDING_SIZE bytes to the bit buffer
for parsing the header in each of aac_parser.c and ac3_parser.c.

Based on patch by: Matt Wolenetz <wolenetz@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fccd85b9f3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 01:31:57 +01:00
Michael Niedermayer
509239066a Merge commit '0e810255596070e2c503c5da9001f7087f71de6e' into release/0.10
* commit '0e810255596070e2c503c5da9001f7087f71de6e':
  doc: More changelog updates for v0.8.17

Conflicts:
	Changelog

not merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 23:12:31 +01:00
Michael Niedermayer
a0316589e4 Merge commit '335ec616cc38ee6206a3acebd46d01aad73d721b' into release/0.10
* commit '335ec616cc38ee6206a3acebd46d01aad73d721b':
  utvideodec: Handle slice_height being zero

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 23:11:51 +01:00
Michael Niedermayer
9575bd6a9d Merge commit '76435f5e40854567252756ea7f788958dd2cc04c' into release/0.10
* commit '76435f5e40854567252756ea7f788958dd2cc04c':
  doc: More changelog updates for v0.8.17

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 23:09:55 +01:00
Michael Niedermayer
90afa95a55 Merge commit 'ec5b2f6a385959048f780b4e7d3d259dc1fa8421' into release/0.10
* commit 'ec5b2f6a385959048f780b4e7d3d259dc1fa8421':
  tiff: Check that there is no aliasing in pixel format selection

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:51:08 +01:00
Michael Niedermayer
817ed4fae9 Merge commit '82776caf7993221719eefbe576f851c7e52dfef9' into release/0.10
* commit '82776caf7993221719eefbe576f851c7e52dfef9':
  rmenc: limit packet size

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:50:49 +01:00
Michael Niedermayer
22377751c9 Merge commit '905988fe1a8accbc1ab93120aa4cd29252b81cce' into release/0.10
* commit '905988fe1a8accbc1ab93120aa4cd29252b81cce':
  eamad: check for out of bounds read

Conflicts:
	libavcodec/eamad.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:50:00 +01:00
Michael Niedermayer
cb4da0405d Merge commit '8b1f8fb26bfe6a4cd9f72b962b45643fa331dbe1' into release/0.10
* commit '8b1f8fb26bfe6a4cd9f72b962b45643fa331dbe1':
  Update Changelog for 0.8.17 Release

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:49:09 +01:00
Michael Niedermayer
7f9527d30f Merge commit 'aace8b184c867875e2715b2af23fa98886f90427' into release/0.10
* commit 'aace8b184c867875e2715b2af23fa98886f90427':
  Prepare for 0.8.17 Release

Conflicts:
	RELEASE

not merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:39:24 +01:00
Michael Niedermayer
60feb8543a Merge commit 'd6deed7916f7f52dbfc88e2fc2c43e3cfb8ee74b' into release/0.10
* commit 'd6deed7916f7f52dbfc88e2fc2c43e3cfb8ee74b':
  h264_cabac: Break infinite loops

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:38:55 +01:00
Michael Niedermayer
3eaef560a7 Merge commit '51dd54c51aaca909893c9f90a4119e96ff71ffdf' into release/0.10
* commit '51dd54c51aaca909893c9f90a4119e96ff71ffdf':
  matroskadec: Fix read-after-free in matroska_read_seek()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:37:20 +01:00
Michael Niedermayer
caedb041a6 Merge commit '9ae3cd6e7271a3d6b8cd92a4d35ebb16d2e03f1a' into release/0.10
* commit '9ae3cd6e7271a3d6b8cd92a4d35ebb16d2e03f1a':
  gifdec: refactor interleave end handling

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:32:12 +01:00
Michael Niedermayer
ed69f0f72e Merge commit 'a331e11906b196c9a00f5ffbc45d80fcd7fe8423' into release/0.10
* commit 'a331e11906b196c9a00f5ffbc45d80fcd7fe8423':
  smc: fix the bounds check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:31:57 +01:00
Michael Niedermayer
8439378f41 Merge commit 'fc159ba88ea2dd1fa11e4ab6af8b574fc80db454' into release/0.10
* commit 'fc159ba88ea2dd1fa11e4ab6af8b574fc80db454':
  mmvideo: check frame dimensions

Conflicts:
	libavcodec/mmvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:31:40 +01:00
Michael Niedermayer
17f094697d Merge commit '954aafaa961c32c655ad38fb622e8cbe249ebd5a' into release/0.10
* commit '954aafaa961c32c655ad38fb622e8cbe249ebd5a':
  jvdec: check frame dimensions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:21:47 +01:00
Michael Niedermayer
522c7c37d2 Merge commit '0ceb2dffb6ba082a8abcc57c53a14b2512f0aa48' into release/0.10
* commit '0ceb2dffb6ba082a8abcc57c53a14b2512f0aa48':
  mov: avoid a memleak when multiple stss boxes are present

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:20:32 +01:00
Michael Niedermayer
525689ede9 Merge commit '22103315c2a1cb2de336750c50cf6bf7c109220c' into release/0.10
* commit '22103315c2a1cb2de336750c50cf6bf7c109220c':
  Add some bug references to the changelog

Conflicts:
	Changelog

not merged as this isnt the FFmpeg Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:19:49 +01:00
Michael Niedermayer
c1f9be99d7 Merge commit 'b989bb7adee0f3286dcaa63c5cd0753eac45f6be' into release/0.10
* commit 'b989bb7adee0f3286dcaa63c5cd0753eac45f6be':
  apetag: Fix APE tag size check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:05:04 +01:00
Michael Niedermayer
c388db185c Merge commit '893b353362bc220280efd8d14c4878a1cafe18a8' into release/0.10
* commit '893b353362bc220280efd8d14c4878a1cafe18a8':
  x86: Only use optimizations with cmov if the CPU supports the instruction

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:04:45 +01:00
Michael Niedermayer
a19a10a53e Merge commit '8637f4edeee1a6bd18bc90740fafadd3e1b412aa' into release/0.10
* commit '8637f4edeee1a6bd18bc90740fafadd3e1b412aa':
  x86: Add CPU flag for the i686 cmov instruction

Conflicts:
	doc/APIchanges
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 22:04:04 +01:00
Michael Niedermayer
efdca97cf1 Merge commit 'c6af9e944ebeb336f6520f59afaebb62392fb026' into release/0.10
* commit 'c6af9e944ebeb336f6520f59afaebb62392fb026':
  Update Changelog for v0.8.16
  Prepare for 0.8.16 release
  Update Changelog for v0.8.15

Conflicts:
	Changelog
	RELEASE

not merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:55:54 +01:00
Michael Niedermayer
9ba0719244 Merge commit 'f661006f235fa58bc756610cdc76c662ac0fab5f' into release/0.10
* commit 'f661006f235fa58bc756610cdc76c662ac0fab5f':
  doc: Fix syntax and logical errors in avconv stream combination example

Conflicts:
	doc/avconv.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:54:41 +01:00
Michael Niedermayer
8e37603ac9 Merge commit '554fd5cd630073b8273aa044a6bdfd6f608209e9' into release/0.10
* commit '554fd5cd630073b8273aa044a6bdfd6f608209e9':
  ffmpeg: Clarify wording of ffmpeg --> avconv deprecation message

Conflicts:
	ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:50:29 +01:00
Michael Niedermayer
35e88167ea Merge commit '2deac60a387409dcbc7b37a8c30de89c7aeb58ac' into release/0.10
* commit '2deac60a387409dcbc7b37a8c30de89c7aeb58ac':
  adpcmenc: Calculate the IMA_QT predictor without overflow

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:50:03 +01:00
Michael Niedermayer
82c8abb34f Merge commit '3eed35addb461c42471e0367bb6cd68d8ffd3aec' into release/0.10
* commit '3eed35addb461c42471e0367bb6cd68d8ffd3aec':
  svq1enc: Set picture_structure correctly

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:49:42 +01:00
Michael Niedermayer
7801f3e509 Merge commit 'ec0df23765bd41846f66e4a4fb694779b432fc62' into release/0.10
* commit 'ec0df23765bd41846f66e4a4fb694779b432fc62':
  h264: Remove an assert on current_picture_ptr being null

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:44:24 +01:00
Michael Niedermayer
240d7a7fc2 Merge commit '372f742dd18911dc5c6552b1bb2e2ca235c5ee47' into release/0.10
* commit '372f742dd18911dc5c6552b1bb2e2ca235c5ee47':
  parser: Don't use pc as context for av_dlog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:44:09 +01:00
Michael Niedermayer
6c76f3dfaa Merge commit 'd1c490448cbe3f7715773c673e92139a7192326f' into release/0.10
* commit 'd1c490448cbe3f7715773c673e92139a7192326f':
  mpegvideo: remove last_picture_ptr / h264 assert.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:43:52 +01:00
Michael Niedermayer
9d94589852 Merge commit '9858a723cbcb206287fd0232d74c6a0991eecdc8' into release/0.10
* commit '9858a723cbcb206287fd0232d74c6a0991eecdc8':
  elbg: Fix an assert

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:37:53 +01:00
Michael Niedermayer
99ba7ee0eb Merge commit 'ce57531a8894d69e3da085c7c6cba45b1f133b35' into release/0.10
* commit 'ce57531a8894d69e3da085c7c6cba45b1f133b35':
  swscale: Remove two bogus asserts

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:37:09 +01:00
Michael Niedermayer
c9a38ffe2f Merge commit '233d1b4861e252cbc4571840e7f264e1db151c13' into release/0.10
* commit '233d1b4861e252cbc4571840e7f264e1db151c13':
  h264_refs: Fix debug tprintf argument types

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:36:34 +01:00
Michael Niedermayer
60190d8612 Merge commit '90a2359fef5325f90aec0eca51b145d90ca3df7d' into release/0.10
* commit '90a2359fef5325f90aec0eca51b145d90ca3df7d':
  nutdec: Remove unused and broken debug function stub

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:32:10 +01:00
Michael Niedermayer
3832db1223 Merge commit '57c36de7265761dd94fb6bb4a9180011f796128f' into release/0.10
* commit '57c36de7265761dd94fb6bb4a9180011f796128f':
  vp8: avoid race condition on segment map.

Conflicts:
	libavcodec/vp8.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:29:31 +01:00
Michael Niedermayer
2a4d9b9af0 Merge commit '8152b02f33a7b939cb2c9a5f26d10cd10465d4f9' into release/0.10
* commit '8152b02f33a7b939cb2c9a5f26d10cd10465d4f9':
  arm/neon: dsputil: use correct size specifiers on vld1/vst1

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:11:07 +01:00
Michael Niedermayer
6a28ae55c4 Merge commit '9fa9d471a7af57a62843fdae0dc36e67960c3f3d' into release/0.10
* commit '9fa9d471a7af57a62843fdae0dc36e67960c3f3d':
  arm: dsputil: prettify some conditional instructions in put_pixels macros

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:10:31 +01:00
Michael Niedermayer
78518fb928 Merge commit '6dd19ffd39babd651744082301d133264a30882c' into release/0.10
* commit '6dd19ffd39babd651744082301d133264a30882c':
  arm: dsputil: fix overreads in put/avg_pixels functions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 21:10:08 +01:00
Reinhard Tartler
0e81025559 doc: More changelog updates for v0.8.17 2015-03-09 22:11:14 -04:00
Michael Niedermayer
335ec616cc utvideodec: Handle slice_height being zero
Fixes out of array accesses.

CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Bug-Id: CVE-2014-9604
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0ce3a0f9d9)
(cherry picked from commit 3a417a86b3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit e032e647dd)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 789f433bc6)

Conflicts:
	libavcodec/utvideodec.c
2015-03-09 22:08:49 -04:00
Reinhard Tartler
76435f5e40 doc: More changelog updates for v0.8.17 2015-03-08 22:34:43 -04:00
Anton Khirnov
ec5b2f6a38 tiff: Check that there is no aliasing in pixel format selection
Fixes possible issues with unexpected bpp/bppcount values.

CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Bug-Id: CVE-2014-8544
(cherry picked from commit ae5e1f3d66)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit eb9041403d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62b0462e5f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2015-03-08 22:30:43 -04:00
Andreas Cadhalpun
82776caf79 rmenc: limit packet size
The chunk size is limited to UINT16_MAX (written by avio_wb16), so make
sure that the packet size is not too large.

Such large frames need to be split into slices smaller than 64 kB, but
that is currently supported neither by the rv10/rv20 encoders nor the rm
muxer.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-03-08 20:37:26 +00:00
Federico Tomassetti
905988fe1a eamad: check for out of bounds read
Bug-Id: CID 1257500
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-03-08 20:36:47 +00:00
Reinhard Tartler
8b1f8fb26b Update Changelog for 0.8.17 Release 2015-03-08 11:32:09 -04:00
Reinhard Tartler
aace8b184c Prepare for 0.8.17 Release 2015-03-08 11:29:56 -04:00
Michael Niedermayer
d6deed7916 h264_cabac: Break infinite loops
This fixes out of array reads and/or infinite loops.

30 is the maximum number of bits that can be read into
coeff_abs below.

CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-23 00:06:28 +00:00
Xiaohan Wang
51dd54c51a 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:34 +00:00
Michael Niedermayer
9ae3cd6e72 gifdec: refactor interleave end handling
Fixes invalid writes with very small image heights.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8547
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 0b39ac6f54)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit eac49477aa)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 92888e9ed4)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 02de44073a)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-20 11:19:47 +01:00
Michael Niedermayer
a331e11906 smc: fix the bounds check
Fixes invalid writes when there are more blocks in a run than total
remaining blocks.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8548
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit d423dd72be)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 58dc526ebf)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit f249e98891)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 306ee95088)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-20 11:16:34 +01:00
Anton Khirnov
fc159ba88e mmvideo: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 2.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8543
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 17ba719d9b)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 69a930b988)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 3f10a779b4)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/mmvideo.c

(cherry picked from commit 03dba25a40)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-20 11:16:27 +01:00
Anton Khirnov
954aafaa96 jvdec: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 8.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8542
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 88626e5af8)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 55788572ea)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8f238dd9bd)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/jvdec.c

(cherry picked from commit 50cb695bf1)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/jvdec.c
2014-12-20 11:16:15 +01:00
Anton Khirnov
0ceb2dffb6 mov: avoid a memleak when multiple stss boxes are present
CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 64f7575fbd)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 577f1feb3f)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 931f5b2351)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 93f919d0b4)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-20 11:15:47 +01:00
Diego Biurrun
22103315c2 Add some bug references to the changelog 2014-09-26 03:17:31 -07:00
Katerina Barone-Adesi
b989bb7ade 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.

(cherry picked from commit 56ac2cbd04)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavformat/apetag.c
2014-09-17 07:50:55 -07:00
Diego Biurrun
893b353362 x86: Only use optimizations with cmov if the CPU supports the instruction
Also fill in missing hash for AV_CPU_FLAG_CMOV addition in APIChanges.

(cherry picked from commit fe07c9c6b5)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavcodec/x86/dsputil_mmx.c
2014-09-16 01:48:53 -07:00
Diego Biurrun
8637f4edee x86: Add CPU flag for the i686 cmov instruction
(cherry picked from commit 65345a5a30)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavutil/cpu.c
	libavutil/cpu.h
2014-09-16 01:39:13 -07:00
Diego Biurrun
c6af9e944e Update Changelog for v0.8.16 2014-09-10 12:46:05 -07:00
Diego Biurrun
992da6b76c Prepare for 0.8.16 release 2014-09-10 12:43:08 -07:00
Diego Biurrun
e9e7646379 Update Changelog for v0.8.15 2014-09-10 12:42:12 -07:00
Diego Biurrun
f661006f23 doc: Fix syntax and logical errors in avconv stream combination example
Bug-Id: 661
CC: libav-stable@libav.org
(cherry picked from commit 775a0b04f0)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-10 12:11:01 -07:00
Diego Biurrun
554fd5cd63 ffmpeg: Clarify wording of ffmpeg --> avconv deprecation message 2014-09-04 16:14:54 -07:00
Michael Niedermayer
2deac60a38 adpcmenc: Calculate the IMA_QT predictor without overflow
Previously, the value given to put_bits was 10 bits long for positive
predictors, even though 9 bits were to be written. The extra bit could
in some cases overwrite existing bits in the bitstream writer cache.

This fixes a failed assert in put_bits.h, when running a version
built with -DDEBUG.

The fate test result gets slightly improved, thanks to getting rid
of the overwritten bits in the bitstream writer cache.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit aa264da5bf)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	tests/ref/fate/acodec-adpcm-ima_qt
2014-08-23 05:19:12 -07:00
Michael Niedermayer
3eed35addb svq1enc: Set picture_structure correctly
This fixes assert failures when running in debug mode.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2d7d91f06d)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-23 05:19:12 -07:00
Michael Niedermayer
ec0df23765 h264: Remove an assert on current_picture_ptr being null
It is possible in various error paths as well as gap handling
that this has already been allocated. It is not clear why that
would be a problem with the current code, thus disable the
assert to avoid a common assert failure when asserts are enabled.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5e997688f8)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-23 05:19:12 -07:00
Martin Storsjö
372f742dd1 parser: Don't use pc as context for av_dlog
The ParserContext class doesn't have an AVClass, required for
using it as a logging class.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 6d65496990)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-23 05:19:12 -07:00
Michael Niedermayer
d1c490448c mpegvideo: remove last_picture_ptr / h264 assert.
This assert is no longer true since h264 error concealment needs
last_picture_ptr to be set.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 91672504a4)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavcodec/mpegvideo.c
2014-08-21 05:40:26 -07:00
Michael Niedermayer
9858a723cb elbg: Fix an assert
It seems the condition was flipped from what was intended.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2c340596ca)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-21 05:40:26 -07:00
Diego Biurrun
ce57531a88 swscale: Remove two bogus asserts
(cherry picked from commit b9141aa346)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libswscale/swscale.c
2014-08-21 05:40:26 -07:00
Diego Biurrun
233d1b4861 h264_refs: Fix debug tprintf argument types
(cherry picked from commit 6c5b0517e0)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-20 10:19:33 -07:00
Diego Biurrun
90a2359fef nutdec: Remove unused and broken debug function stub
(cherry picked from commit 83655442fa)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavformat/nutdec.c
2014-08-20 10:11:31 -07:00
Aaron Colwell
57c36de726 vp8: avoid race condition on segment map.
This change avoids accessing the segment map of the previous frame if
segmentation is not enabled for the current frame. The caller of
decode_mb_mode() only calls ff_thread_await_progress() on the reference
segmentation index array if segmentation is enabled, so Chromium's TSAN
will report a race when accessing this data while segmentation is not
enabled.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 30011bf201)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-19 06:15:26 -07:00
Mans Rullgard
8152b02f33 arm/neon: dsputil: use correct size specifiers on vld1/vst1
Change the size specifiers to match the actual element sizes
of the data.  This makes no practical difference with strict
alignment checking disabled (the default) other than somewhat
documenting the code.  With strict alignment checking on, it
avoids trapping the unaligned loads.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2014-08-17 09:52:39 +02:00
Mans Rullgard
9fa9d471a7 arm: dsputil: prettify some conditional instructions in put_pixels macros
Signed-off-by: Mans Rullgard <mans@mansr.com>
2014-08-17 09:52:23 +02:00
Mans Rullgard
6dd19ffd39 arm: dsputil: fix overreads in put/avg_pixels functions
The vertically interpolating variants of these functions read
ahead one line to optimise the loop.  On the last line processed,
this might be outside the buffer.  Fix these invalid reads by
processing the last line outside the loop.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2014-08-17 09:52:13 +02:00
Michael Niedermayer
c13b19a5bc Update for 0.10.15
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:44:27 +02:00
Mans Rullgard
394f4ee61e pcmenc: set correct bitrate value
This fixes a bogus bitrate value in the header of WAV files with
alaw/ulaw audio.

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

Conflicts:

	libavcodec/pcm.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:36:47 +02:00
Michael Niedermayer
497d661262 Merge commit 'b5d7b80a7e43779ca2962ba56442579c2a7e927d' into release/0.10
* commit 'b5d7b80a7e43779ca2962ba56442579c2a7e927d':
  ffv1dec: check that global parameters do not change in version 0/1

Conflicts:
	libavcodec/ffv1.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:28:37 +02:00
Michael Niedermayer
8044ab94e4 Merge commit '452e343295e25f7b2cbc8529c66e9386e2ea6f55' into release/0.10
* commit '452e343295e25f7b2cbc8529c66e9386e2ea6f55':
  avcodec: Add more missing #includes for ff_get_buffer()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:26:07 +02:00
Michael Niedermayer
257188acea Merge commit '5a2d1913a96bb0e029b424a4dd5b414cfb91c708' into release/0.10
* commit '5a2d1913a96bb0e029b424a4dd5b414cfb91c708':
  Prepare for 0.8.15 Release

Conflicts:
	RELEASE

Not merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:25:48 +02:00
Michael Niedermayer
80a77c0c5b avcodec/libspeexdec: fix missing header includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:13:11 +02:00
Michael Niedermayer
854fa0d1ab Merge commit 'e24d1cbc4e134e0b4448b3bc3a80f3197271b347' into release/0.10
* commit 'e24d1cbc4e134e0b4448b3bc3a80f3197271b347':
  lavf: Fix leftovers from the ff_get_buffer patch

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:01:58 +02:00
Michael Niedermayer
5d790cdb9e Merge commit 'c98d164a6a2c3d93bfb10d44c946bc3ed56f14e7' into release/0.10
* commit 'c98d164a6a2c3d93bfb10d44c946bc3ed56f14e7':
  configure: Check for -Werror parameters on clang

Conflicts:
	configure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:01:22 +02:00
Michael Niedermayer
bb015b519e Merge commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b' into release/0.10
* commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b':
  avcodec: Introduce ff_get_buffer

Conflicts:
	libavcodec/8svx.c
	libavcodec/dpcm.c
	libavcodec/utils.c
	libavcodec/vmdav.c
	libavcodec/yop.c

See: 668494acd8
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:53:37 +02:00
Michael Niedermayer
acf7c5b8ee Merge commit '042c25f54bd25b52d2936b822be026450971a82d' into release/0.10
* commit '042c25f54bd25b52d2936b822be026450971a82d':
  Update Changelog for v0.8.14

Conflicts:
	Changelog

Not merged as the Changelog isnt correct for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:13:07 +02:00
Michael Niedermayer
a5a2f8ac5a Merge commit 'dcc68de942f06d358192a57057adb133f7c40dd7' into release/0.10
* commit 'dcc68de942f06d358192a57057adb133f7c40dd7':
  vp3: Copy all 3 frames for thread updates

See: 247d30a7db
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:11:33 +02:00
Michael Niedermayer
437a0ae1a1 Merge commit 'ebe2292eafa7cac71dcdddb865e18c05635fe117' into release/0.10
* commit 'ebe2292eafa7cac71dcdddb865e18c05635fe117':
  mpegts: Do not try to write a PMT larger than SECTION_SIZE

Conflicts:
	libavformat/mpegtsenc.c

See: 68b14c044a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:09:33 +02:00
Michael Niedermayer
da19bfb287 Merge commit 'd86df7dd497ead1132bd95df7c4c18d91fbe3def' into release/0.10
* commit 'd86df7dd497ead1132bd95df7c4c18d91fbe3def':
  mpegts: Define the section length with a constant

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:01:28 +02:00
Michael Niedermayer
a94fe0e151 Merge commit 'a79e58cdc6e46c62346d13e7ddd4da2008714200' into release/0.10
* commit 'a79e58cdc6e46c62346d13e7ddd4da2008714200':
  Update Changelog for v0.8.14
  Prepare for 0.8.14 Release

Conflicts:
	Changelog
	RELEASE

No change as this does not apply to FFmpeg 1:1

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:00:30 +02:00
Michael Niedermayer
688ab26604 Merge commit 'c79cf0129edafc388ba1c47cd7b6a620557e48de' into release/0.10
* commit 'c79cf0129edafc388ba1c47cd7b6a620557e48de':
  error_concealment: avoid using the picture if not fully setup

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:58:09 +02:00
Michael Niedermayer
a2c6cb260f avcodec/svq1dec: Fix multiple bugs from "svq1: do not modify the input packet"
Add padding, clear size, use the correct pointer.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:51:33 +02:00
Michael Niedermayer
aed8f48545 Merge commit '9d5f4f025304ac7c69775179044e6f69f370441a' into release/0.10
* commit '9d5f4f025304ac7c69775179044e6f69f370441a':
  svq1: do not modify the input packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:51:22 +02:00
Michael Niedermayer
6596f5c3aa Merge commit 'cf6b2a0ad2b06aabf04bec4c7b19e78a560cd904' into release/0.10
* commit 'cf6b2a0ad2b06aabf04bec4c7b19e78a560cd904':
  cdgraphics: do not return 0 from the decode function

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:47:24 +02:00
Michael Niedermayer
a457115f0f Merge commit '3aebdffb010df025728d6c2af89642f9634aa806' into release/0.10
* commit '3aebdffb010df025728d6c2af89642f9634aa806':
  cdgraphics: switch to bytestream2

Conflicts:
	libavcodec/cdgraphics.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:25:32 +02:00
Michael Niedermayer
b5d7b80a7e ffv1dec: check that global parameters do not change in version 0/1
Such changes are neither allowed nor supported

Found-by: ami_stuff
Bug-Id: CVE-2013-7020
CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit da7d839a0d)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/ffv1dec.c
2014-08-12 10:49:43 +00:00
Michael Niedermayer
90241187ce Merge commit 'a1804df66a4064aa30554a11e4fd6cdac3ed89c0' into release/0.10
* commit 'a1804df66a4064aa30554a11e4fd6cdac3ed89c0':
  huffyuvdec: check width size for yuv422p

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 20:21:22 +02:00
Michael Niedermayer
e719bfc403 Merge commit 'e17dc0a254ac8d3c33887a114a66e2b659ba0bc5' into release/0.10
* commit 'e17dc0a254ac8d3c33887a114a66e2b659ba0bc5':
  mmvideo: check horizontal coordinate too

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 20:20:02 +02:00
Michael Niedermayer
7d42ede8fe Merge commit '4a6622550a4a4bf4690ea7d9fe42210a30a67936' into release/0.10
* commit '4a6622550a4a4bf4690ea7d9fe42210a30a67936':
  huffyuv: Check and propagate function return values

Conflicts:
	libavcodec/huffyuv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:58:37 +02:00
Michael Niedermayer
2ec8e46550 Merge commit '50493f1f7d2235db811d2991b9e5b330baf7c05a' into release/0.10
* commit '50493f1f7d2235db811d2991b9e5b330baf7c05a':
  twinvq: fix out of bounds array access

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:42:46 +02:00
Michael Niedermayer
b5ae0e349a Merge commit '3e60501f311c50bf234033f206c19d34d889df01' into release/0.10
* commit '3e60501f311c50bf234033f206c19d34d889df01':
  h264: slice-mt: check master context for valid current_picture_ptr

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:42:15 +02:00
Michael Niedermayer
0a83007cee Merge commit '7585a6254bbb38148e4467793fc34211b79d5f7d' into release/0.10
* commit '7585a6254bbb38148e4467793fc34211b79d5f7d':
  h264: prevent theoretical infinite loop in SEI parsing

Conflicts:
	libavcodec/h264_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:41:51 +02:00
Michael Niedermayer
330791c2ae Merge commit '184c79729d4011f33027bcdc61a63d521017ebc1' into release/0.10
* commit '184c79729d4011f33027bcdc61a63d521017ebc1':
  h264_sei: check SEI size

Conflicts:
	libavcodec/h264_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:30:07 +02:00
Michael Niedermayer
5404bf29c3 Merge commit 'a465ed5707f5cbc9713d5e9629d424cd2d46e038' into release/0.10
* commit 'a465ed5707f5cbc9713d5e9629d424cd2d46e038':
  pgssubdec: Check RLE size before copying

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:29:48 +02:00
Michael Niedermayer
2c10833d5e Merge commit '976f2e0a542e47aaf68ddbe001fb70a00bf96d99' into release/0.10
* commit '976f2e0a542e47aaf68ddbe001fb70a00bf96d99':
  x86: Fix linking with some or all of yasm, mmx, optimizations disabled

Conflicts:
	libavcodec/x86/mpegaudiodec_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:20:25 +02:00
Michael Niedermayer
cdfd61b78b Merge commit '28f2d3c5a5a3a3c14a68cf691054f15e4f23355a' into release/0.10
* commit '28f2d3c5a5a3a3c14a68cf691054f15e4f23355a':
  cmdutils: Conditionally compile libswscale-related bits

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:15:49 +02:00
Michael Niedermayer
f3ae90621e Merge commit '277103e07fbe22fc8e4361bacd5c6b48133f3ba5' into release/0.10
* commit '277103e07fbe22fc8e4361bacd5c6b48133f3ba5':
  video4linux2: Avoid a floating point exception

Conflicts:
	avconv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:13:54 +02:00
Michael Niedermayer
c4dabc38a3 Merge commit 'e4fdfdf65d520ce3af13a21ff8a3649e37757af8' into release/0.10
* commit 'e4fdfdf65d520ce3af13a21ff8a3649e37757af8':
  vf_select: Drop a debug av_log with an unchecked double to enum conversion

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:12:46 +02:00
Michael Niedermayer
d60f680fa7 Merge commit '187cfd3c13a1deb47661486824a5b8f41e158a7a' into release/0.10
* commit '187cfd3c13a1deb47661486824a5b8f41e158a7a':
  eamad: use the bytestream2 API instead of AV_RL

Conflicts:
	libavcodec/eamad.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:04:40 +02:00
Reinhard Tartler
452e343295 avcodec: Add more missing #includes for ff_get_buffer() 2014-08-09 08:22:11 -07:00
Reinhard Tartler
5a2d1913a9 Prepare for 0.8.15 Release 2014-08-09 09:09:24 -04:00
Luca Barbato
e24d1cbc4e lavf: Fix leftovers from the ff_get_buffer patch
The automated script did not perfectly replace all the instances nor
added internal.h in all the files requiring it.
2014-08-09 14:14:34 +02:00
Martin Storsjö
c98d164a6a configure: Check for -Werror parameters on clang
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9eded0fe41)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-09 14:13:49 +02:00
Luca Barbato
0ab76ddf31 avcodec: Introduce ff_get_buffer
Validate the image size there as is done in the other release
branches.

Bug-Id: CVE-2011-3935
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-08-09 04:01:15 +02:00
Reinhard Tartler
042c25f54b Update Changelog for v0.8.14 2014-08-08 20:49:45 -04:00
Michael Niedermayer
dcc68de942 vp3: Copy all 3 frames for thread updates
Fixes a double release of the current frame on deinit.

Bug-Id: CVE-2011-3934
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-08 15:04:18 +01:00
Luca Barbato
ebe2292eaf mpegts: Do not try to write a PMT larger than SECTION_SIZE
Prevent out of array write.

Similar to what Michael Niedermayer did to address the same issue.

Bug-Id: CVE-2014-2263
CC: libav-stable@libav.org
(cherry picked from commit addbaf1348)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-08 14:27:47 +02:00
Luca Barbato
d86df7dd49 mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including
the 4-byte CRC.

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

Conflicts:
	libavformat/mpegtsenc.c
2014-08-08 14:27:27 +02:00
Reinhard Tartler
a79e58cdc6 Update Changelog for v0.8.14 2014-08-06 20:24:58 -04:00
Reinhard Tartler
4709baecc9 Prepare for 0.8.14 Release 2014-08-06 20:24:58 -04:00
Michael Niedermayer
c79cf0129e error_concealment: avoid using the picture if not fully setup
Fixes state becoming inconsistent and a null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CVE-2013-0860
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-06 19:29:48 +00:00
Anton Khirnov
9d5f4f0253 svq1: do not modify the input packet
The input data must remain constant, make a copy instead. This is in
theory a performance hit, but since I failed to find any samples
using this feature, this should not matter in practice.

Also, check the size of the header, avoiding invalid reads on truncated
data.

CC:libav-stable@libav.org
(cherry picked from commit 7b588bb691)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/svq1dec.c
2014-08-06 19:22:05 +00:00
Anton Khirnov
cf6b2a0ad2 cdgraphics: do not return 0 from the decode function
0 means no data consumed, so it can trigger an infinite loop in the
caller.

CC:libav-stable@libav.org
(cherry picked from commit c7d9b473e2)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/cdgraphics.c
2014-08-06 18:52:28 +00:00
Anton Khirnov
3aebdffb01 cdgraphics: switch to bytestream2
Fixes possible invalid memory accesses on corrupted data.

CC:libav-stable@libav.org
Bug-ID: CVE-2013-3674
(cherry picked from commit a1599f3f7e)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-06 18:51:49 +00:00
Michael Niedermayer
a1804df66a huffyuvdec: check width size for yuv422p
Avoid out of array accesses.

CC: libav-stable@libav.org
Bug-Id: CVE-2013-0848
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit a7153444df)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/huffyuvdec.c
2014-08-05 20:17:19 +00:00
Michael Niedermayer
e17dc0a254 mmvideo: check horizontal coordinate too
Fixes out of array accesses.

Bug-Id: CVE-2013-3672
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 70cd3b8e65)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-05 19:32:56 +00:00
Diego Biurrun
4a6622550a huffyuv: Check and propagate function return values
Bug-Id: CVE-2013-0868

inspired by a patch from Michael Niedermayer <michaelni@gmx.at>
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

(cherry picked from commit 744b406ff3)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavcodec/huffyuvdec.c
2014-08-04 00:24:21 -07:00
Mans Rullgard
50493f1f7d twinvq: fix out of bounds array access
ModeTab.fmode has only 3 elements, so indexing it with ftype
in the initialier for 'size' is invalid when ftype == FT_PPC.

This fixes crashes with gcc 4.8.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 4bf2e7c5f1)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 07:51:18 -07:00
Janne Grunau
3e60501f31 h264: slice-mt: check master context for valid current_picture_ptr
Fixes errors in slice based multithreading introduced in 0b300daad2.

CC: libav-stable@libav.org
(cherry picked from commit 5945c7b35d)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 07:37:14 -07:00
Vittorio Giovara
7585a6254b h264: prevent theoretical infinite loop in SEI parsing
Properly address CVE-2011-3946 and parse bitstream as described in the spec.

CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-08-01 13:40:11 +01:00
Michael Niedermayer
184c79729d h264_sei: check SEI size
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-01 13:39:51 +01:00
Michael Niedermayer
a465ed5707 pgssubdec: Check RLE size before copying
Make sure the buffer size does not exceed the expected
RLE size.

Prevent an out of array bound write.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Bug-Id: CVE-2013-0852

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 00915d3cd2)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 05:19:04 -07:00
Diego Biurrun
976f2e0a54 x86: Fix linking with some or all of yasm, mmx, optimizations disabled
Some optimized template functions reference optimized symbols, so they
must be explicitly disabled when those symbols are unavailable.

(cherry picked from commit ec36aa6944)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-31 18:05:34 -07:00
Diego Biurrun
28f2d3c5a5 cmdutils: Conditionally compile libswscale-related bits
This fixes compilation with libswscale disabled.

(cherry picked from commit ab79966475)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-31 16:44:11 -07:00
Bernhard Übelacker
277103e07f video4linux2: Avoid a floating point exception
This avoids a segfault in avconv_opt.c:opt_target when trying to
determine the norm.

(cherry picked from commit dc71f19588)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 13:09:09 -07:00
Diego Biurrun
e4fdfdf65d vf_select: Drop a debug av_log with an unchecked double to enum conversion
CC: libav-stable@libav.org
(cherry picked from commit a8d803a320)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 13:06:22 -07:00
Anton Khirnov
187cfd3c13 eamad: use the bytestream2 API instead of AV_RL
This is safer and possibly fixes invalid reads on truncated data.
(cherry-picked from commit 541427ab4d)

CC:libav-stable@libav.org

Conflicts:
	libavcodec/eamad.c

(cherry picked from commit f9204ec56a)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 12:42:35 -07:00
Michael Niedermayer
9153b33a74 update for FFmpeg 0.10.14
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:26:12 +02:00
Michael Niedermayer
a907fc0b21 Merge commit 'e122fb594a5feb6729cce86a70aafd93d10202d8' into release/0.10
* commit 'e122fb594a5feb6729cce86a70aafd93d10202d8':
  Update Changelog for 0.8.13
  Prepare for 0.8.13 Release

Conflicts:
	Changelog
	RELEASE

merge for metadata only

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:10:10 +02:00
Michael Niedermayer
d77ad6ec2d Merge commit 'e7f5dacd55deeee8a866020b8463f829b2c5971f' into release/0.10
* commit 'e7f5dacd55deeee8a866020b8463f829b2c5971f':
  lzo: Handle integer overflow

Conflicts:
	libavutil/lzo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:08:22 +02:00
Reinhard Tartler
e122fb594a Update Changelog for 0.8.13 2014-06-26 21:34:03 -04:00
Reinhard Tartler
359383c983 Prepare for 0.8.13 Release 2014-06-26 21:33:18 -04:00
Luca Barbato
e7f5dacd55 lzo: Handle integer overflow
get_len can overflow for specially crafted payload.

Reported-By: Don A. Baley <donb@securitymouse.com>
CC: libav-stable@libav.org
(cherry picked from commit ccda51b14c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavutil/lzo.c
2014-06-25 14:40:56 +02:00
Michael Niedermayer
6a968073da avutil/lzo: Fix integer overflow
Embargoed-till: 2014-06-27 requested by researcher, but embargo broken by libav today (git and mailing list)

Fixes: LMS-2014-06-16-4
Found-by: "Don A. Bailey" <donb@securitymouse.com>
See: ccda51b14c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d6af26c55c)

Conflicts:

	libavutil/lzo.c
(cherry picked from commit 7b5c706494)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 15:21:18 +02:00
Michael Niedermayer
c1ac5896ef Merge commit '9c7321e2b8981ec867294309e9cf3833055df78f' into release/0.10
* commit '9c7321e2b8981ec867294309e9cf3833055df78f':
  sgidec: fix an incorrect backport

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 01:32:33 +02:00
Sean McGovern
9c7321e2b8 sgidec: fix an incorrect backport
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-17 21:50:20 +02:00
Michael Niedermayer
da97174dcb update for 0.10.13
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 02:00:04 +02:00
Michael Niedermayer
6a679279f7 avcodec/mjpegdec: Fix undefined shift
Fixes CID1194388

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:05 +02:00
Michael Niedermayer
dd8464bc99 avformat/h263dec: Fix h263 probe
The code was missing 1 bit in the src format

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:05 +02:00
Michael Niedermayer
363cf196c9 avfilter/vf_deshake: fix loss of precission with odd resolutions
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 73734282e0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:04 +02:00
Michael Niedermayer
90b69d1d02 avcodec/diracdec: fix undefined behavior with shifts
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b8598f6ce6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
71a3ad42b8 avformat/mpegts: Remove redundant check
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff6fa0b4b9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
ec29aec618 swscale/x86/swscale_template: loose hardcoded dstw_offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f6759d9ad4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
6cf254ea68 avcodec/wma: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d167faafe9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
f24246a889 avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets
Fixes h264_mp4toannexb_bsf_failure.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Dale Curtis
2facb10f70 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 ae3d416369)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
3b977a6ded avcodec/alsdec: Clear MPEG4AudioConfig so that no use of uninitialized memory is possible
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e6bd5481c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-08 14:32:41 +02:00
Michael Niedermayer
2088340173 Merge commit '9552b37e2604552d5ff210175d6baf28ccc2bb80' into release/0.10
* commit '9552b37e2604552d5ff210175d6baf28ccc2bb80':
  Add some bug references
  Update Changelog for 0.8.12
  Prepare for 0.8.12 Release

Conflicts:
	Changelog
	RELEASE

Not merged, as these changes are not correct for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:50:29 +02:00
Michael Niedermayer
952738d0af Merge commit '6f4404b24bcf59ab29cd4b57995d374a578f51a7' into release/0.10
* commit '6f4404b24bcf59ab29cd4b57995d374a578f51a7':
  h264: set parameters from SPS whenever it changes
  alac: Limit max_samples_per_frame

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:45:10 +02:00
Michael Niedermayer
d499685d80 Merge commit '7fa72700298107fe756311ecb4dee5270ff12d35' into release/0.10
* commit '7fa72700298107fe756311ecb4dee5270ff12d35':
  swscale: Fix an undefined behaviour
  apedec: do not buffer decoded samples over AVPackets
  isom: lpcm in mov default to big endian

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:41:19 +02:00
Michael Niedermayer
0be41c6586 Merge commit '5463a2b0566b34b9e3847db9ceb1ef1d2a6004fc' into release/0.10
* commit '5463a2b0566b34b9e3847db9ceb1ef1d2a6004fc':
  movdec: handle 0x7fff langcode as macintosh per the specs
  avi: Improve non-interleaved detection

Conflicts:
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:34:10 +02:00
Michael Niedermayer
18b233428a Merge commit '079758e49a4d6b3e7cf2e22bed71d34c46712242' into release/0.10
* commit '079758e49a4d6b3e7cf2e22bed71d34c46712242':
  h264: reset next_output_pic earlier in start_frame()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:32:58 +02:00
Michael Niedermayer
c437ab3c4e Merge commit 'a0a90b1a1116250a2494021da810cc5da89ea36f' into release/0.10
* commit 'a0a90b1a1116250a2494021da810cc5da89ea36f':
  tiffdec: use bytestream2 to simplify overread/overwrite protection

Conflicts:
	libavcodec/tiff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:27:34 +02:00
Michael Niedermayer
b827189c6f Merge commit 'fa60904ebd58da33abf10b05e9933d24619cf096' into release/0.10
* commit 'fa60904ebd58da33abf10b05e9933d24619cf096':
  bytestream: add bytestream2_copy_buffer() functions
  bytestream: add functions for accessing size of buffer
  movenc: allow override of "writing application" tag

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:23:03 +02:00
Michael Niedermayer
fe30351d52 Merge commit '330c18032464a4e1f3da907e54db2e69a6fbfcda' into release/0.10
* commit '330c18032464a4e1f3da907e54db2e69a6fbfcda':
  matroskaenc: allow override of "writing application" tag
  avfilter: Add missing emms_c when needed
  mpeg12: check scantable indices in all decode_block functions

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:18:16 +02:00
Michael Niedermayer
7c520e5cd6 Merge commit '71b8c8430cf3f7056849257324fc39b423075ba1' into release/0.10
* commit '71b8c8430cf3f7056849257324fc39b423075ba1':
  sgidec: fix buffer size check in expand_rle_row()
  adx: check that the offset is not negative
  mpegvideo: set reference/pict_type on generated reference frames

Conflicts:
	libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:14:02 +02:00
Michael Niedermayer
d076ee5216 Merge commit '27ac9585c97d35b809382be5634c8e5f7211243a' into release/0.10
* commit '27ac9585c97d35b809382be5634c8e5f7211243a':
  h264: reset data partitioning at the beginning of each decode call

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:53 +02:00
Michael Niedermayer
8d32735629 Merge commit '35ba079fbf281a066f3ac1e1271f3caa402dcd74' into release/0.10
* commit '35ba079fbf281a066f3ac1e1271f3caa402dcd74':
  h264: reset ref count if decoding the slice header fails

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:33 +02:00
Michael Niedermayer
0558832796 Merge commit 'a7cce9ebf3ae3b9678970236c964900393603a73' into release/0.10
* commit 'a7cce9ebf3ae3b9678970236c964900393603a73':
  h264: reset first_field if frame_start() fails for missing refs

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:16 +02:00
Michael Niedermayer
ced5c8e6b3 Merge commit '51ae8e26af8f5b26efb41edc0fe4812368d16ae9' into release/0.10
* commit '51ae8e26af8f5b26efb41edc0fe4812368d16ae9':
  h264: limit allowed pred modes in ff_h264_check_intra_pred_mode() to 3

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:46:59 +02:00
Michael Niedermayer
1e83191d5c Merge commit 'c4033cd4eb921a9cc8deb513efc6d6a6ba3b2163' into release/0.10
* commit 'c4033cd4eb921a9cc8deb513efc6d6a6ba3b2163':
  h264: reject mismatching luma/chroma bit depths during sps parsing

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_ps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:39:49 +02:00
Michael Niedermayer
69db5f2779 Merge commit '7f33a24e824c6d20cb941e6b20c5382becfbc923' into release/0.10
* commit '7f33a24e824c6d20cb941e6b20c5382becfbc923':
  h264: check that execute_decode_slices() is not called too many times

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:38:03 +02:00
Michael Niedermayer
97a5b4ba53 Merge commit '0f71a5df4bc913f17a53c7ac66d4957914fa1d3d' into release/0.10
* commit '0f71a5df4bc913f17a53c7ac66d4957914fa1d3d':
  h264: do not use 422 functions for monochrome

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:37:45 +02:00
Michael Niedermayer
f2275400fe Merge commit '3ee26080d6b3e777992b4b4124e62e1bf0ac0a65' into release/0.10
* commit '3ee26080d6b3e777992b4b4124e62e1bf0ac0a65':
  h264: reset data_partitioning if decoding the slice header for NAL_DPA fails

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:27:27 +02:00
Michael Niedermayer
1ab94468dd Merge commit 'e0d8a17402b934b8fba7b86c6c990abf1257901b' into release/0.10
* commit 'e0d8a17402b934b8fba7b86c6c990abf1257901b':
  h264_refs: make sure not to write over the bounds of the default ref list

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:27:12 +02:00
Michael Niedermayer
ef076d3bd6 Merge commit '2cbc8dfeddcbe00ef5f112162912bb49c1dd6623' into release/0.10
* commit '2cbc8dfeddcbe00ef5f112162912bb49c1dd6623':
  h264: check buffer size before accessing it
  configure: use utilities from /usr/xpg4/bin if it exists

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:26:51 +02:00
Michael Niedermayer
2b40afae70 Merge commit 'ecf21ab0ec798eea96f862333568336098b4610c' into release/0.10
* commit 'ecf21ab0ec798eea96f862333568336098b4610c':
  cmdutils: update copyright year to 2014.
  ituh263: reject b-frame with pp_time = 0

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:17:01 +02:00
Michael Niedermayer
bca2ebbeee doc: switch github urls to https
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 675a66a93b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:03:53 +02:00
Michael Niedermayer
53dcd772aa Merge commit 'f1a8885ae9e7f281b597d1f9188fc16fb2ab7832' into release/0.10
* commit 'f1a8885ae9e7f281b597d1f9188fc16fb2ab7832':
  doc: Point to the correct, actually maintained gas-preprocessor repo

Conflicts:
	doc/platform.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:03:19 +02:00
Michael Niedermayer
2f894deeda Merge commit 'aedf1a2996e70d322220d2704d5a615c4f7b1b23' into release/0.10
* commit 'aedf1a2996e70d322220d2704d5a615c4f7b1b23':
  Update Changelog for 0.8.11
  configure: Update freetype check to follow upstream

Conflicts:
	Changelog

Changelog not merged as it does not match for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:01:32 +02:00
Michael Niedermayer
e771425e98 Merge commit 'ec772cca60423b9994fe00c7cef239f93eae6112' into release/0.10
* commit 'ec772cca60423b9994fe00c7cef239f93eae6112':
  drawtext: Drop pointless header
  configure: Support preprocessor macros as header names

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 00:54:37 +02:00
Reinhard Tartler
9552b37e26 Add some bug references 2014-06-01 16:12:58 -04:00
Sean McGovern
d75b149757 Update Changelog for 0.8.12 2014-06-01 14:20:46 -04:00
Reinhard Tartler
516ea2dccd Prepare for 0.8.12 Release 2014-05-31 20:09:10 -04:00
Janne Grunau
6f4404b24b h264: set parameters from SPS whenever it changes
Fixes a crash in the fuzzed sample sample_varPAR.avi_s26638 with
alternating bit depths.
2014-05-31 20:07:52 -04:00
Luca Barbato
7fa7270029 swscale: Fix an undefined behaviour
Prevent a division by zero down the codepath.

Sample-Id: 00001721-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-05-31 20:07:52 -04:00
Martin Storsjö
110680c5a2 alac: Limit max_samples_per_frame
Otherwise buffer size calculations in allocate_buffers could
overflow later, making the code think a large enough buffer
actually was allocated.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-05-31 20:07:52 -04:00
Rafaël Carré
65c3593792 apedec: do not buffer decoded samples over AVPackets
Only consume an AVPacket when all the samples have been read.

When the rate of samples output is limited (by the default value
of max_samples), consuming the first packet immediately will cause
timing problems:

- The first packet with PTS 0 will output 4608 samples and be
consumed entirely
- The second packet with PTS 64 will output the remaining samples
(typically, a lot, that's why max_samples exist) until the decoded
samples of the first packet have been exhausted, at which point the
samples of the second packet will be decoded and output when
av_decode_frame is called with the next packet).

That means there's a PTS jump since the first packet is 'decoded'
immediately, which can be seen with avplay or mplayer: the timing
jumps immediately to 6.2s (which is the size of a packet).

Sample: http://streams.videolan.org/issues/6348/Goldwave-MAClib.ape

Bug-Debian: http://bugs.debian.org/744901
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 91d4cfb812)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-05-31 20:07:52 -04:00
Mark Himsley
b7b798a1af isom: lpcm in mov default to big endian
It is my understanding that "Unless otherwise stated, all data in a
QuickTime movie is stored in big-endian byte ordering" [1] in MOV files.

I have a couple of thousand files, which technically are invalid because
their sound sample description element 4CC is 'lpcm' but its version is
0 - and "Version 0 supports only uncompressed audio in raw ('raw ') or
twos-complement ('twos') format" [2]

Because isom.c only contains a mapping for 4CC 'lpcm' to
AV_CODEC_ID_PCM_S16LE, these files have their audio decoded as LE when
it is actually BE.

This commit adds AV_CODEC_ID_PCM_S16BE as the first match for 4CC 'lpcm'.

[1]
https://developer.apple.com/library/mac/documentation/quicktime/QTFF/qtff.pdf
page 21
[2]
https://developer.apple.com/library/mac/documentation/quicktime/QTFF/qtff.pdf
page 178

Reviewed-by: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
2014-05-31 20:07:52 -04:00
Baptiste Coudurier
5463a2b056 movdec: handle 0x7fff langcode as macintosh per the specs
The correct point that seperates ISO and MAC language codes is 0x400
according to the current QT spec. Old QT specs did not list where this
seperation is but apparently only defined the meaning of the first 137.

(cherry picked from commit 9e71cc81f3)
(cherry picked from commit 7940306a47)
2014-05-31 20:07:51 -04:00
Anton Khirnov
079758e49a h264: reset next_output_pic earlier in start_frame()
In case start_frame() fails, this potentially invalid frame can still be
output to the caller.

Bug-Id: 672
Bug-Id: debian/741240
Bug-Id: ubuntu/1288206
2014-05-31 20:07:51 -04:00
Michael Niedermayer
42dcfe32a8 avi: Improve non-interleaved detection
Additional fixes by Nigel Touati-Evans <nigel.touatievans@gmail.com>.

Check the index for streams with a time drift of 2s or a buffer drift
of 64MB.

Bug-Id: 666
CC: libav-stable@libav.org
Sample-Id: yet-another-broken-interleaved-avi.avi

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-05-31 20:07:51 -04:00
Justin Ruggles
a0a90b1a11 tiffdec: use bytestream2 to simplify overread/overwrite protection
Based on a patch by Paul B Mahol <onemda@gmail.com>

CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Justin Ruggles
fa60904ebd bytestream: add bytestream2_copy_buffer() functions
This is basically an overread/overwrite-safe memcpy between a
GetByteContext and a PutByteContext.

CC:libav-stable@libav.org
(cherry picked from commit 5748faf291)
2014-05-31 20:05:19 -04:00
John Stebbins
330c180324 matroskaenc: allow override of "writing application" tag
Signed-off-by: Tim Walker <tdskywalker@gmail.com>

CC: libav-stable@libav.org
(cherry picked from commit 0092c1dd8d)
2014-05-31 20:05:19 -04:00
Anton Khirnov
71b8c8430c sgidec: fix buffer size check in expand_rle_row()
Right now it will spuriously fail if the linesize is exactly equal to
the data width.

CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
27ac9585c9 h264: reset data partitioning at the beginning of each decode call
Prevents using GetBitContexts with data from previous calls.

Fixes access to freed memory.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
35ba079fbf h264: reset ref count if decoding the slice header fails
Otherwise the ER code might try to use some already freed references.

Fixes possible access to freed memory.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
a7cce9ebf3 h264: reset first_field if frame_start() fails for missing refs
In this case we may not have a current frame, while first_field being
set implies we do.

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
51ae8e26af h264: limit allowed pred modes in ff_h264_check_intra_pred_mode() to 3
Higher modes are not allowed for 16x16/chroma, which is what this
function is used for. Otherwise this function would return 0 (vertical
prediction) for invalid higher modes, which could result in invalid
reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
c4033cd4eb h264: reject mismatching luma/chroma bit depths during sps parsing
There is no point in delaying the check and it avoids bugs with a
half-initialized context.

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Paul B Mahol
b473fdcde3 bytestream: add functions for accessing size of buffer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>

CC:libav-stable@libav.org
(cherry picked from commit de9d2705f6)
2014-05-31 20:05:19 -04:00
Luca Barbato
1dce4a031f avfilter: Add missing emms_c when needed
Arch specific calls should have an emms_c following to keep the cpu
state consistent.

Reported-By: wm4
CC: libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
d0ecfe3249 adx: check that the offset is not negative
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 5569146d48)
2014-05-31 20:05:19 -04:00
John Stebbins
db52f056c3 movenc: allow override of "writing application" tag
Signed-off-by: Tim Walker <tdskywalker@gmail.com>

CC: libav-stable@libav.org
(cherry picked from commit 565e0c6d86)
2014-05-31 20:05:19 -04:00
Janne Grunau
9938e450c8 mpeg12: check scantable indices in all decode_block functions
Add checks to the fast functions used with CODEC_FLAGS2_FAST and move
the check for all other functions to before the invalid memory is
accessed. Fixes https://trac.videolan.org/vlc/ticket/9713 with
CODEC_FLAGS2_FAST.

CC: libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
07558d0b9f mpegvideo: set reference/pict_type on generated reference frames
Otherwise the generic code will unref them, which can then result in
last_picture_ptr == current_picture_ptr, which causes deadlocks at least
in rv40.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
7f33a24e82 h264: check that execute_decode_slices() is not called too many times
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
0f71a5df4b h264: do not use 422 functions for monochrome
Fixes invalid memory access.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
3ee26080d6 h264: reset data_partitioning if decoding the slice header for NAL_DPA fails
If it was set before then we can end up trying to decode a slice without
a valid slice header, which can lead to invalid memory access.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
e0d8a17402 h264_refs: make sure not to write over the bounds of the default ref list
Fixes invalid writes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
2cbc8dfedd h264: check buffer size before accessing it
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Johan Andersson
ecf21ab0ec cmdutils: update copyright year to 2014.
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-05-31 20:05:18 -04:00
Mans Rullgard
afab4c422b configure: use utilities from /usr/xpg4/bin if it exists
Solaris defaults to non-standard utilities (grep, sed, ...) with
proper ones being in /usr/xpg4/bin.  Prefixing PATH with this
directory when it exists ensures we get correct variants.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2014-05-31 20:05:18 -04:00
Keiji Costantini
16f0f97eec ituh263: reject b-frame with pp_time = 0
Avoid a division by 0 in ff_mpeg4_set_one_direct_mv.

Sample-Id: 00000168-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
(cherry picked from commit 9514440337)
(cherry picked from commit 5df52b0131)
(cherry picked from commit aa2a3ca27a)
2014-05-31 20:03:35 -04:00
Martin Storsjö
f1a8885ae9 doc: Point to the correct, actually maintained gas-preprocessor repo
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d15c536123)
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-16 20:56:04 +02:00
Reinhard Tartler
aedf1a2996 Update Changelog for 0.8.11 2014-03-13 20:59:00 -04:00
Luca Barbato
bf0cb89a8d configure: Update freetype check to follow upstream
The freetype tutorial suggests to use #include FT_FREETYPE_H.

Bug-Id: 616
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit e61b8fa560)

Conflicts:
	configure
2014-03-13 12:47:49 +01:00
Luca Barbato
ec772cca60 drawtext: Drop pointless header
It should be forward compatible with newer freetype.

(cherry picked from commit d68dc3c944)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-13 12:47:12 +01:00
Diego Biurrun
7b00340f97 configure: Support preprocessor macros as header names
New versions of FreeType have moved the location of their API
header(s) and hide the location behind a macro.

Since the location changes between versions and no other way
to know the location exists, this workaround becomes necessary.

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

Conflicts:
	configure
2014-03-13 12:46:10 +01:00
Michael Niedermayer
6f9e6ac6aa update for 0.10.12
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 19:00:59 +01:00
Michael Niedermayer
43b1762ab8 avcodec/snow: split block clipping checks
Fixes out of array read
Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61d59703c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
f157f18b34 avcodec/msrle: use av_image_get_linesize() to calculate the linesize
Fixes out of array access
Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c919e1ca2e)

Conflicts:

	libavcodec/msrle.c
(cherry picked from commit bc1c8ec5e6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
68b14c044a avformat/mpegtsenc: Check data array size in mpegts_write_pmt()
Prevents out of array writes

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

Conflicts:

	libavformat/mpegtsenc.c
(cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ae51d93983 avcodec/wmalosslessdec: fix mclms_coeffs* array size
Fixes corruption of context
Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec9578d54d)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ca8c3ec11b wmalosslessdec: make mclms arrays big enough for whats written into them.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0abefb0af)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
4e47ae4e71 avcodec/vc1: reset fcm/field_mode in non advanced header parsing
Fixes NULL pointer dereference
Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b51e935477)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
5cab56dc9e avcodec/vmnc: Check that rectangles are within the picture
Prevents out of array accesses with CODEC_FLAG_EMU_EDGE

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

Conflicts:

	libavcodec/vmnc.c

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
98f44b24b5 dnxhdenc: fix mb_rc size
Fixes out of array access with RC_VARIANCE set to 0

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ad4963a944 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
  arm: hpeldsp: prevent overreads in armv6 asm
  lagarith: reallocate rgb_planes when needed
  lagarith: avoid infinite loop in lag_rac_refill()

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:48:51 +01:00
Michael Niedermayer
5640ea43d7 Merge commit '2c1d84499bfe06d75e9160b824eeffd9f5587337' into release/0.10
* commit '2c1d84499bfe06d75e9160b824eeffd9f5587337':
  lagarith: pad RGB buffer by 1 byte.
  truemotion1: check the header size
  shorten: pad the internal bitstream buffer
  samplefmt: avoid integer overflow in av_samples_get_buffer_size()
  h264: Fix a typo from the previous commit
  h264: Lower bound check for slice offsets
  rpza: limit the number of blocks to the total remaining blocks in the frame

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:39:02 +01:00
Michael Niedermayer
15efd9a7c0 Merge commit '36017d49e2f797f7371dc24848a2285ca63e39ab' into release/0.10
* commit '36017d49e2f797f7371dc24848a2285ca63e39ab':
  Prepare for 0.8.11 Release
  lavf: make av_probe_input_buffer more robust
  Updated Changelog for 0.8.10
  oggparseogm: check timing variables
  mathematics: remove asserts from av_rescale_rnd()
  vc1: Always reset numref when parsing a new frame header.
  h264: reset num_reorder_frames if it is invalid

Conflicts:
	RELEASE
	libavcodec/vc1.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:31:07 +01:00
Michael Niedermayer
0d82c3a0ca Merge commit '979f77b0dc40571761999633a38d97be9a1670c8' into release/0.10
* commit '979f77b0dc40571761999633a38d97be9a1670c8':
  h264: check that an IDR NAL only contains I slices
  mov: Free an earlier allocated array if allocating a new one
  segafilm: fix leaks if reading the header fails
  h264_cavlc: check the size of the intra PCM data.
  cavs: Check for negative cbp
  avi: DV in AVI must be considered single stream
  avutil: use align == 0 for default alignment in audio sample buffer functions

Conflicts:
	libavcodec/cavsdec.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:14:20 +01:00
Michael Niedermayer
b7a750f67f Merge commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a' into release/0.10
* commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a':
  flashsv: Check diff_start diff_height values
  dsputil/pngdsp: fix signed/unsigned type in end comparison
  vqavideo: check chunk sizes before reading chunks
  avi: directly resync on DV in AVI read failure
  get_bits: change the failure condition in init_get_bits
  twinvq: Cope with gcc-4.8.2 miscompilation

Conflicts:
	libavcodec/dsputil.c
	libavcodec/flashsv.c
	libavcodec/get_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:06:35 +01:00
Janne Grunau
0120e480bf arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
The overread avoidance fix in cbddee1cca
broke the computation for the last row since it prevented the safe
reading from the height+1-th row.
2014-03-09 00:31:31 +01:00
Janne Grunau
fd2fc130b2 arm: hpeldsp: prevent overreads in armv6 asm
Based on a patch by Russel King <rmk+libav@arm.linux.org.uk>

Bug-Id: 646
CC: libav-stable@libav.org
2014-03-06 09:06:39 +01:00
Anton Khirnov
3da4fdd5ac lagarith: reallocate rgb_planes when needed
Fixes invalid writes on pixel format changes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 4c3e1956ee)
(cherry picked from commit bd57e783437f990c3ac4747eeebe20332e103980)
2014-02-28 23:07:41 -05:00
Ronald S. Bultje
2c1d84499b lagarith: pad RGB buffer by 1 byte.
For left HFYU prediction, we predict from the buffer buf+1 using 8- or
16-byte reads. This means that aligning the buffer by 16 bytes is in
itself not sufficient, because if the width itself is 16- or 8-byte
aligned, the buffer will not be padded, and thus a read of size 16 at
buf+1 will overflow boundaries at the right edge. Padding the buffer by
1 byte is sufficient to not overflow its boundaries.

Fixes bug 342.

(cherry picked from commit 98d0d19208)
2014-02-28 23:07:40 -05:00
Anton Khirnov
2fb0a52e70 lagarith: avoid infinite loop in lag_rac_refill()
range == 0 happens with corrupted files

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 8bce2c60b8)
2014-02-28 23:07:40 -05:00
Anton Khirnov
de0e442e9d truemotion1: check the header size
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 2240e2078d)
(cherry picked from commit 76b40a9bf93e387d98aa7dc02ec7a8d13f51722f)
2014-02-28 23:07:40 -05:00
Anton Khirnov
43aa7eb38e shorten: pad the internal bitstream buffer
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 1713eec29a)
(cherry picked from commit 5881ec0ea58a95403bd375b63f22d49905cdd8e5)
2014-02-28 23:07:40 -05:00
Justin Ruggles
9786c24bb7 samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
(cherry picked from commit 0e830094ad)
(cherry picked from commit e9b3abd49890e958c745ea46a9f4f91b6b4baa58)

Conflicts:
	libavutil/samplefmt.c
2014-02-28 23:07:40 -05:00
Luca Barbato
4279e0e8d0 h264: Fix a typo from the previous commit
f777504f64 changed a - in +

CC: libav-stable@libav.org
(cherry picked from commit d922c5a5fb)
(cherry picked from commit 3ce77e04c2ca4b9e7fa6b94b51e8d7c5f188da86)
(cherry picked from commit 8cba6f58c8acaa0ca6749110a2746bbe60ff2dab)
2014-02-28 23:07:40 -05:00
Vittorio Giovara
a6003760bd h264: Lower bound check for slice offsets
And use the value from the specification.

Sample-Id: 00000451-google
Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

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

Conflicts:
	libavcodec/h264.c

(cherry picked from commit 41380e017afcca3119acb560c08a60a97d416c3c)

Conflicts:
	libavcodec/h264.c
2014-02-28 23:07:40 -05:00
Anton Khirnov
cf676c159b rpza: limit the number of blocks to the total remaining blocks in the frame
Fixes invalid writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 77bb0004bb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-02-14 11:43:59 +01:00
Reinhard Tartler
36017d49e2 Prepare for 0.8.11 Release 2014-02-06 23:26:33 -05:00
Anton Khirnov
8cade1352b lavf: make av_probe_input_buffer more robust
Always use the actually read size as the offset instead of making
possibly invalid assumptions.

Addresses: CVE-2012-6618

(cherry picked from commit 2115a35974)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/utils.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8575f5362f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-06 23:01:14 -05:00
Reinhard Tartler
5522c564d4 Updated Changelog for 0.8.10 2014-02-02 12:54:52 -05:00
Anton Khirnov
b0db7a523d oggparseogm: check timing variables
Fixes a potential divide by zero.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 75647dea6f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit bf7c240a50)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:58 -05:00
Anton Khirnov
e03b875c0b mathematics: remove asserts from av_rescale_rnd()
It is a public function, it must not assert on its parameters.

(cherry picked from commit 94a417acc0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 03bfd8419f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:45 -05:00
Michael Niedermayer
30c8a5e4f6 vc1: Always reset numref when parsing a new frame header.
Fixes an issue where the B-frame coding mode switches from interlaced
fields to interlaced frames, causing incorrect decisions in the motion
compensation code and resulting in visual artifacts.

CC: libav-stable@libav.org
Signed-off-by: Tim Walker <tdskywalker@gmail.com>
(cherry picked from commit dd2d0039b6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 3cc8d9bc1f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:34 -05:00
Anton Khirnov
716ee73c99 h264: reset num_reorder_frames if it is invalid
An invalid VUI is not considered a fatal error, so the SPS containing it
may still be used. Leaving an invalid value of num_reorder_frames there
can result in writing over the bounds of H264Context.delayed_pic.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 9ecabd7892)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264_ps.c

(cherry picked from commit 299c5dcfb0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:16 -05:00
Anton Khirnov
979f77b0dc h264: check that an IDR NAL only contains I slices
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 8b2e5e42bb)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62ed6da016)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264.c
2014-02-02 12:48:04 -05:00
Martin Storsjö
2f4e066d66 mov: Free an earlier allocated array if allocating a new one
It could probably also be considered an error if the pointer isn't
null at this point, but then we might risk rejecting some
slightly broken files that we might have handled so far.

Sample-Id: 00000496-google
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 2620df1310)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit a1b4d42d31)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:45:09 -05:00
Anton Khirnov
6a56d16dc1 segafilm: fix leaks if reading the header fails
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 6892d145a0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f728782c0d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/segafilm.c
2014-02-02 12:44:20 -05:00
Anton Khirnov
23144c5f06 h264_cavlc: check the size of the intra PCM data.
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit b5275ca1a8)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:41:02 -05:00
Luca Barbato
e964207e6c cavs: Check for negative cbp
Sample-Id: 00000647-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c85e5f13f6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/cavsdec.c
2014-02-02 12:36:15 -05:00
Luca Barbato
2c0bfce4cb avi: DV in AVI must be considered single stream
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3485a07977)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:29:54 -05:00
Justin Ruggles
b68e5b1195 avutil: use align == 0 for default alignment in audio sample buffer functions
Fixes: http://pad.lv/1264886, http://pad.lv/1241439
(cherry picked from commit 0109a09dc3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavutil/avutil.h
2014-02-01 14:59:12 -05:00
Michael Niedermayer
cb5d0ea0be flashsv: Check diff_start diff_height values
Fix out of array accesses.

Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Adresses: CVE-2013-7015
(cherry picked from commit 57070b1468)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 10d48fe6d3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:06:24 -05:00
Michael Niedermayer
ef6c90e102 dsputil/pngdsp: fix signed/unsigned type in end comparison
Fixes out of array accesses and integer overflows.

(cherry picked from commit d1916d13e2)
Adresses: CVE-2013-7010, CVE-2013-7014

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit af9799790d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/pngdsp.c
2014-02-01 14:05:47 -05:00
Michael Niedermayer
d04194db45 vqavideo: check chunk sizes before reading chunks
Fixes out of array writes

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

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

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f7d18deb73)

Addresses: CVE-2013-0865

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit ab434bf0d0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:03:28 -05:00
Luca Barbato
976a7b72a3 avi: directly resync on DV in AVI read failure
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ceec6e792e)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Adresses CVE-2013-0856
(cherry picked from commit 61057f4604)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:02:20 -05:00
Luca Barbato
a89acaa0b0 get_bits: change the failure condition in init_get_bits
Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.

Check for NULL buffer instead.

(cherry picked from commit 4603ec85ed)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-25 01:01:25 +01:00
Michael Niedermayer
41216ebb9e update for 0.10.11
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:37:49 +01:00
Michael Niedermayer
86a423d2b8 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Changelog for 0.8.10
  pthread: Avoid spurious wakeups

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:32:09 +01:00
Michael Niedermayer
a26bfc444d Merge commit '48d57650f121d3d9e977832e9006bb334337d921' into release/0.10
* commit '48d57650f121d3d9e977832e9006bb334337d921':
  pthread: Fix deadlock during thread initialization
  mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
  vc1dec: Don't decode slices when the latest slice header failed to decode

Conflicts:
	libavcodec/mpegvideo.c
	libavcodec/pthread.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:23:09 +01:00
Michael Niedermayer
93e3ec451c Merge commit '9925f7df0a50387ade8d83cb85b40c53e41e7041' into release/0.10
* commit '9925f7df0a50387ade8d83cb85b40c53e41e7041':
  vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
  r3d: Add more input value validation
  fraps: Make the input buffer size checks more strict
  svq3: Avoid a division by zero
  rmdec: Validate the fps value
  twinvqdec: Check the ibps parameter separately
  asfdec: Check the return value of asf_read_stream_properties
  mxfdec: set audio timebase to 1/samplerate
  pcx: Check the packet size before assuming it fits a palette
  rpza: Fix a buffer size check
  xxan: Disallow odd width
  xan: Only read within the data that actually was initialized

Conflicts:
	libavcodec/fraps.c
	libavformat/mxfdec.c
	tests/ref/seek/lavf_mxf
	tests/ref/seek/lavf_mxf_d10

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:44:32 +01:00
Michael Niedermayer
76c48a78d1 Merge commit '993977032a0adb47eb70e7fef6ce0d5370027e83' into release/0.10
* commit '993977032a0adb47eb70e7fef6ce0d5370027e83':
  xan: Use bytestream2 to limit reading to within the buffer
  pcx: Consume the whole packet if giving up due to missing palette
  pngdec: Stop trying to decode once inflate returns Z_STREAM_END
  mov: Make sure the read sample count is nonnegative
  bfi: Add some very basic sanity checks for input packet sizes

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:31:18 +01:00
Michael Niedermayer
6c0c799bd5 Merge commit '5e8243e843be8f71da7dde199a71d095726533eb' into release/0.10
* commit '5e8243e843be8f71da7dde199a71d095726533eb':
  bfi: Avoid divisions by zero
  electronicarts: Add more sanity checking for the number of channels
  riffdec: Add sanity checks for the sample rate
  mvi: Add sanity checking for the audio frame size
  xwma: Avoid division by zero
  avidec: Make sure a packet is large enough before reading its data
  vqf: Make sure the bitrate is in the valid range
  vqf: Make sure sample_rate is set to a valid value
  vc1dec: Undo mpegvideo initialization if unable to allocate tables

Conflicts:
	libavformat/riff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:24:42 +01:00
Michael Niedermayer
d1c7a7776f Merge commit '159993acc7f4e3155510d42c543e09fe972b933c' into release/0.10
* commit '159993acc7f4e3155510d42c543e09fe972b933c':
  vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
  wnv1: Make sure the input packet is large enough
  dca: Validate the lfe parameter
  rl2: Avoid a division by zero
  wtv: Add more sanity checks for a length read from the file
  segafilm: Validate the number of audio channels
  qpeg: Add checks for running out of rows in qpeg_decode_inter
  mpegaudiodec: Validate that the number of channels fits at the given offset
  asv1: Verify the amount of extradata
  idroqdec: Make sure a video stream has been allocated before returning packets
  rv10: Validate the dimensions set from the container
  xmv: Add more sanity checks for parameters read from the bitstream
  ffv1: Make sure at least one slice context is initialized
  truemotion2: Use av_freep properly in an error path

Conflicts:
	libavcodec/qpeg.c
	libavcodec/wnv1.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:02:02 +01:00
Michael Niedermayer
5339a9f000 Merge commit 'b19eafa2b930ee40abfde6d1f026b7fa5591c4dc' into release/0.10
* commit 'b19eafa2b930ee40abfde6d1f026b7fa5591c4dc':
  eacmv: Make sure a reference frame exists before referencing it
  mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
  ivi_common: Make sure color planes have been initialized
  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
  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/eacmv.c
	libavcodec/mpeg4videodec.c
	libavformat/omadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:53:50 +01:00
Michael Niedermayer
bd953f9404 Merge commit '486c45767587151b517bb6fde602d43d178da203' into release/0.10
* commit '486c45767587151b517bb6fde602d43d178da203':
  mpc8: Check the seek table size parsed from the bitstream
  zmbvdec: Check the buffer size for uncompressed data
  ape: Don't allow the seektable to be omitted
  shorten: Break out of loop looking for fmt chunk if none is found
  shorten: Use a checked bytestream reader for the wave header
  smacker: Make sure we don't fill in huffman codes out of range

Conflicts:
	libavcodec/shorten.c
	libavcodec/smacker.c
	libavcodec/zmbv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:50:17 +01:00
Michael Niedermayer
9e96051d5d Merge commit '68a1df13c460adb6241cfdf96aad953b5d637623' into release/0.10
* commit '68a1df13c460adb6241cfdf96aad953b5d637623':
  smacker: Avoid integer overflow when allocating packets
  smacker: Don't return packets in unallocated streams
  dsicin: Add some basic sanity checks for fields read from the file
  arm: Don't clobber callee saved registers in scalarproduct
  Prepare for 0.8.10 Release
  roqvideodec: check dimensions validity
  qdm2: check array index before use, fix out of array accesses
  alsdec: check block length

Conflicts:
	RELEASE

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:33:44 +01:00
Michael Niedermayer
85c02da307 cmdutils: update year
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:18:19 +01:00
Luca Barbato
8b24e17d09 twinvq: Cope with gcc-4.8.2 miscompilation
Apparently gcc-4.8.2 miscompiles enums resulting in a lucky fpe soon
after it.

Passing the enum value as integer makes the ftype == FT_PPC condition
evaluates correctly.
2014-01-07 14:21:53 +01:00
Sean McGovern
3736b13753 Changelog for 0.8.10 2014-01-07 09:43:58 +01:00
Derek Buitenhuis
48d57650f1 pthread: Fix deadlock during thread initialization
Sometimes, if pthread_create() failed, then pthread_cond_wait() could
accidentally be called in the worker threads after the uninit function
had already called pthread_cond_broadcast(), leading to a deadlock.

Don't call pthread_cond_wait() if c->done is set.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
(cherry picked from commit 1a5a6ac01b)
2014-01-07 09:43:58 +01:00
Martin Storsjö
9925f7df0a vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
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 5e25fdbfe0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vc1dec.c
(cherry picked from commit 494f2d4f9e)
2014-01-07 09:43:58 +01:00
Ben Jackson
1123870879 pthread: Avoid spurious wakeups
pthread_wait_cond can wake up unexpectedly (Wikipedia: Spurious_wakeup).

The FF_THREAD_SLICE thread mechanism could spontaneously execute
jobs or allow the caller of avctx->execute to return before all
jobs were complete.

Test both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 311583e779)
2014-01-07 09:43:58 +01:00
Martin Storsjö
371659d1ad mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
This fixes breakage in a few fate tests on certain setups
(that for some reason didn't break on OS X) after the previous
commit (8812a8057). Currently, some video streams are initialized
in ff_MPV_common_init with width/height set at 0 and only changed
to a proper video size with ff_MPV_common_frame_size_change later.

The breakage was diagnosed by Anton Khirnov.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-01-07 09:43:58 +01:00
Martin Storsjö
29fa517d40 r3d: Add more input value validation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavformat/r3d.c
2014-01-07 09:43:58 +01:00
Michael Niedermayer
c00e491aeb vc1dec: Don't decode slices when the latest slice header failed to decode
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavcodec/vc1dec.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
fbc52044f3 fraps: Make the input buffer size checks more strict
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavcodec/fraps.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
49c1defee5 svq3: Avoid a division by zero
If the height is zero, the decompression will probably end up
failing due to not fitting into the allocated buffer later
anyway, so this doesn't need any more elaborate check.

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 601c2015bc)
2014-01-07 09:43:58 +01:00
Martin Storsjö
871baf3127 rmdec: Validate the fps value
Abort if it is invalid if strict error checking has been requested.

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 0f310a6f33)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rmdec.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
591d5281f5 twinvqdec: Check the ibps parameter separately
This is required, since invalid parameters actually could
pass the switch check below.

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 c77d409bf9)
(cherry picked from commit 9b9aee27f4)
2014-01-07 09:43:58 +01:00
Martin Storsjö
e972338e35 asfdec: Check the return value of asf_read_stream_properties
This makes sure errors in setting stream parameters are passed
on to the caller. This avoids successfully opening files while
some parameters aren't filled in properly.

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 cc41167aed)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit fc4d11ec9b)
2014-01-07 09:43:58 +01:00
Anton Khirnov
90294e31a1 mxfdec: set audio timebase to 1/samplerate
Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>

Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
(cherry picked from commit 93370d1216)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:58 +01:00
Martin Storsjö
d92c908e23 pcx: Check the packet size before assuming it fits a palette
This fixes reads out of bounds.

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 d1d99e3bef)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pcx.c
(cherry picked from commit 7e350b7ddd)
2014-01-07 09:43:58 +01:00
Martin Storsjö
cb4a101fbe rpza: Fix a buffer size check
We read 2 bytes for 15 out of 16 pixels, therefore we need to
have at least 30 bytes, not 16.

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 7ba0cedbfe)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f06e39fe6b)
2014-01-07 09:43:58 +01:00
Martin Storsjö
993977032a xan: Use bytestream2 to limit reading to within the buffer
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 30db94dc39)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 145de32896)
2014-01-07 09:43:57 +01:00
Martin Storsjö
5e8243e843 bfi: Avoid divisions by zero
If a zero-length video packet is to be returned, just return
AVERROR(EAGAIN) and switch back to the audio stream.

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 9fc7184d1a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ad1223d6bc)
2014-01-07 09:43:57 +01:00
Martin Storsjö
159993acc7 vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
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 ede508443e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit b62704891d)
2014-01-07 09:43:57 +01:00
Martin Storsjö
d3986f4f1b xxan: Disallow odd width
Decoded data is always written in pairs within this decoder.
This fixes writes out of bounds.

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 aa0dd52434)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
5a40e4c64d pcx: Consume the whole packet if giving up due to missing palette
Previously, we returned 0, meaning successful decoding but 0
bytes consumed, leading to an infinite loop.

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 9fb0de86b4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 812955a12b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
416ad3ecf2 electronicarts: Add more sanity checking for the number of channels
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 a9221e3960)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/electronicarts.c
(cherry picked from commit a89868d714)
2014-01-07 09:43:57 +01:00
Martin Storsjö
b29c31c21e wnv1: Make sure the input packet is large enough
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 91be1103fd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0c8c6b4419)
2014-01-07 09:43:57 +01:00
Martin Storsjö
380e373267 xan: Only read within the data that actually was initialized
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 fc739b3eef)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 09ace619d6)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ac1e61d559 pngdec: Stop trying to decode once inflate returns Z_STREAM_END
If the input buffer contains more data after the deflate stream,
the loop previously left running infinitely, with inflate returning
Z_STREAM_END.

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 a81cad8f86)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit a63e83cd4b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
7fdb915fc7 riffdec: Add sanity checks for the sample rate
This avoids a division by zero for G726.

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 d07aa3f02b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 607863acae)
2014-01-07 09:43:57 +01:00
Martin Storsjö
456a939210 dca: Validate the lfe parameter
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 a9d50bb578)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
1438181a29 mov: Make sure the read sample count is nonnegative
This avoids setting a negative number of frames, ending up with a
negative average frame rate.

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 c231987662)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit c10f3fed25)
2014-01-07 09:43:57 +01:00
Martin Storsjö
35c39d2ee2 mvi: Add sanity checking for the audio frame size
This avoids a division by zero.

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 28ff439efd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 04d2f9ace3)
2014-01-07 09:43:57 +01:00
Martin Storsjö
c211ba9b59 rl2: Avoid a division by zero
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 3ca14aa596)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ce1dacb435)
2014-01-07 09:43:57 +01:00
Martin Storsjö
213b8aa0a9 bfi: Add some very basic sanity checks for input packet sizes
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 640a2427aa)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 10f384e4f5)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ea1c9424d1 xwma: Avoid division by zero
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 adc09136a4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 2ff935a060)
2014-01-07 09:43:57 +01:00
Martin Storsjö
f23b1cc7d9 wtv: Add more sanity checks for a length read from the file
Also make sure the existing length check can't overflow.

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 83c285f880)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 78dc022f6f)
2014-01-07 09:43:57 +01:00
Martin Storsjö
889bdc47f6 avidec: Make sure a packet is large enough before reading its data
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 8d07258bb6)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/avidec.c
(cherry picked from commit 2e4c649b3e)
2014-01-07 09:43:57 +01:00
Martin Storsjö
e80071892b segafilm: Validate the number of audio channels
This avoids divisions by zero later.

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 82e266c6d3)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 5379c5184b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
efe59ad90b vqf: Make sure the bitrate is in the valid range
Even if the sample rate is valid, an invalid bitrate could
pass the mode combination test below.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 68ff998128)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 60701469ab)
2014-01-07 09:43:57 +01:00
Martin Storsjö
2c31141585 qpeg: Add checks for running out of rows in qpeg_decode_inter
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 7a5a557227)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d90550cf9)
2014-01-07 09:43:57 +01:00
Martin Storsjö
61d56054a9 vqf: Make sure sample_rate is set to a valid value
This avoids divisions by zero later (and possibly assertions in
time base scaling), since an invalid rate_flag combined with an
invalid bitrate below could pass the mode combination test.

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 9277050e29)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d60ab62e0)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ff8837e9c6 mpegaudiodec: Validate that the number of channels fits at the given offset
This is similar to the fix in 35cbc98b.

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 e9d61de96c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit bacf5db196)
2014-01-07 09:43:57 +01:00
Martin Storsjö
cd254e8540 vc1dec: Undo mpegvideo initialization if unable to allocate tables
Previously, s->context_initialized was left set to 1
if ff_vc1_decode_init_alloc_tables failed, skipping the
initialization completely on the next decode call.

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 b772b0e28e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
036136fa89 asv1: Verify the amount of extradata
The init function reads one byte of extradata.

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 f50803354c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
b19eafa2b9 eacmv: Make sure a reference frame exists before referencing it
This is similar to an existing check for the second-last frame
from 062421e3.

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 ea78a348d8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/eacmv.c
(cherry picked from commit 2e12af4587)
2014-01-07 09:43:56 +01:00
Martin Storsjö
486c457675 mpc8: Check the seek table size parsed from the bitstream
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + FF_INPUT_BUFFER_PADDING_SIZE won't overflow.

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 459f2b393a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f8a72f041c)
2014-01-07 09:43:56 +01:00
Martin Storsjö
68a1df13c4 smacker: Avoid integer overflow when allocating packets
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 710b0e2702)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
75dabbff8b idroqdec: Make sure a video stream has been allocated before returning packets
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 bcbe4f3ceb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit de75bc01cd)
2014-01-07 09:43:56 +01:00
Martin Storsjö
e3ba6ff935 mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
This avoids a potential division by zero.

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 f875a732e3)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit c8c93795e4)
2014-01-07 09:43:56 +01:00
Michael Niedermayer
b81d804f2a zmbvdec: Check the buffer size for uncompressed data
Also don't pointlessly set the buffer size to 1 after copying
one packet.

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 0d61f26001)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
61032c577d smacker: Don't return packets in unallocated streams
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 8d928023f9)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
3b169044ca rv10: Validate the dimensions set from the container
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 5372cda671)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0b0f1cd44e)
2014-01-07 09:43:56 +01:00
Martin Storsjö
843b330c3c ivi_common: Make sure color planes have been initialized
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 a92538b7c0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 38bd229af9)
2014-01-07 09:43:56 +01:00
Martin Storsjö
f241d5aa1f ape: Don't allow the seektable to be omitted
The seektable is required for filling in ape->frames[i].pos
further down.

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 183b9d843a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
e01d623e01 dsicin: Add some basic sanity checks for fields read from the file
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 48d6556dd4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
0a23055b8a xmv: Add more sanity checks for parameters read from the bitstream
Since the number of channels is multiplied by 36 and assigned to
to a uint16_t, make sure this calculation didn't overflow. (In
certain cases the calculation could overflow leaving the
truncated block_align at 0, leading to divisions by zero later.)

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 d4c2a3740f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 00516b5491)
2014-01-07 09:43:56 +01:00
Martin Storsjö
33b88170d7 oggparseogm: Convert to use bytestream2
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 19b9659f31)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
7d8a4bb8d2 shorten: Break out of loop looking for fmt chunk if none is found
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 b26742cc30)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
2b71a78841 ffv1: Make sure at least one slice context is initialized
This avoids crashes when initializing the range coder for
the first slice context.

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 b1db33159f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
f0db793bee rv34: Check the return value from ff_rv34_decode_init
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 711c970168)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 20c8f17629)
2014-01-07 09:43:56 +01:00
Martin Storsjö
712945d21e shorten: Use a checked bytestream reader for the wave header
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 49568851bf)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
2ef84218b2 truemotion2: Use av_freep properly in an error path
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 c39f7eba01)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit eac1c3f384)
2014-01-07 09:43:56 +01:00
Martin Storsjö
75f811babc 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 569d18aa9d)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9f7a8b8f8f)
2014-01-07 09:43:56 +01:00
Martin Storsjö
d5c104c1ae smacker: Make sure we don't fill in huffman codes out of range
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 0679cec6e8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
48f27c854f mace: Make sure that the channel count is set to a valid value
Also return a proper error code.

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 e1f3847f86)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/mace.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
802deb2d13 svq3: Check for any negative return value from ff_h264_check_intra_pred_mode
Also pass on any returned error code.

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 1115689d54)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/svq3.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
290783b848 vp3: Check the framerate for validity
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 6fc8226e29)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit b4c479a82a)
2014-01-07 09:43:56 +01:00
Martin Storsjö
7f80928c0e cavsdec: Make sure a sequence header has been decoded before decoding pictures
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 e90a6846c2)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/cavsdec.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
b9e90b36cd sierravmd: Do sanity checking of frame sizes
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + BYTES_PER_FRAME_RECORD won't overflow.

Also factorize other existing error return paths.

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 0ef1660a63)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 153deed18b)
2014-01-07 09:43:56 +01:00
Martin Storsjö
7981b5c20e omadec: Properly check lengths before incrementing the position
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 342c43d154)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9eba02d5dd)
2014-01-07 09:43:56 +01:00
Martin Storsjö
9291012d52 mpc8: Make sure the first stream exists before parsing the seek table
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 17d57848fc)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 557df77eab)
2014-01-07 09:43:56 +01:00
Martin Storsjö
594b843608 arm: Don't clobber callee saved registers in scalarproduct
q4-q7/d8-d15 are supposed to not be clobbered by the callee.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d307e408d4)
2013-12-21 10:00:23 +01:00
Martin Storsjö
b6fc0127ce arm: Don't clobber callee saved registers in scalarproduct
q4-q7/d8-d15 are supposed to not be clobbered by the callee.

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

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-20 22:09:24 +02:00
Reinhard Tartler
b997a6a86d Prepare for 0.8.10 Release 2013-12-14 14:34:28 -05:00
Michael Niedermayer
6f6cd7dbe5 roqvideodec: check dimensions validity
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ae6104511)

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

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 488f87be87)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 52b18c1fde)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:31:29 -05:00
Michael Niedermayer
b5736759ee qdm2: check array index before use, fix out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

(cherry picked from commit a7ee6281f7)

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 39bec05ed4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 0b2b8ab979)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:31:03 -05:00
Reinhard Tartler
d4a24e43ed alsdec: check block length
Fix writing over the end

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Addresses: CVE-2013-0845
(cherry picked from commit 2a0fb7286d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 3f7d89034b)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:30:24 -05:00
Michael Niedermayer
58e212c1fb avcodec/jpeglsdec: check err value for ls_get_code_runterm()
Fixes infinite loop
Fixes Ticket3086

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:49:49 +01:00
Michael Niedermayer
4ddbe89d40 avfilter/ff_insert_pad: fix order of operations
Fixes out of bounds access
Fixes CID732170
Fixes CID732169

No filter is known to use this function in a way so the issue can be reproduced.

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

Conflicts:

	libavfilter/avfilter.c
(cherry picked from commit 86591b244f3a27293153896813f5569b49b2f5c0)

Conflicts:

	libavfilter/avfilter.c
(cherry picked from commit 400c4f8fa3fd58951dc3f356b2b00484e3363694)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:49:49 +01:00
Michael Niedermayer
d83dff2e09 update for 0.10.10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:07:44 +01:00
Michael Niedermayer
5e708b4de3 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Changelog for 0.8.9

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:44:53 +01:00
Michael Niedermayer
8528feb13c Merge commit 'd2f4846591727fedcc2b452b688da8da09ee8305' into release/0.10
* commit 'd2f4846591727fedcc2b452b688da8da09ee8305':
  Prepare for 0.8.7 Release
  x86: fft: Remove 3DNow! optimizations, they break FATE
  x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16

Conflicts:
	RELEASE
	libavcodec/x86/fft_3dn.c
	libavcodec/x86/fft_3dn2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:34:04 +01:00
Michael Niedermayer
2e57d4ba24 Merge commit '2ed8a550da524434deb3b89f7ec62ed833bedac5' into release/0.10
* commit '2ed8a550da524434deb3b89f7ec62ed833bedac5':
  aac: Check init_get_bits return value
  aac: return meaningful errors
  dsicinav: K&R formatting cosmetics

Conflicts:
	libavcodec/dsicinav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:20:29 +01:00
Michael Niedermayer
7c72398787 Merge commit '86d0bf0e96bf917e283d24239ce0eed08351da86' into release/0.10
* commit '86d0bf0e96bf917e283d24239ce0eed08351da86':
  mov: Seek back if overreading an individual atom
  vcr1: add sanity checks
  pictordec: pass correct context to avpriv_request_sample
  dsicinav: Clip the source size to the expected maximum
  alsdec: Clean up error paths
  ogg: Fix potential infinite discard loop
  nuv: check rtjpeg_decode_frame_yuv420 return value

Conflicts:
	libavcodec/pictordec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:07:21 +01:00
Michael Niedermayer
048e284201 Merge commit 'abb41f19cc10fea09fb16d9ecc9967b2a78cf7b0' into release/0.10
* commit 'abb41f19cc10fea09fb16d9ecc9967b2a78cf7b0':
  nuv: Reset the frame on resize
  nuv: Use av_fast_realloc
  nuv: return meaningful error codes.

Conflicts:
	libavcodec/nuv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:01:17 +01:00
Michael Niedermayer
e31518e86e Merge commit '36fc320747a768335ae4538a24a5739033b7eb74' into release/0.10
* commit '36fc320747a768335ae4538a24a5739033b7eb74':
  nuv: Pad the lzo outbuf
  nuv: Do not ignore lzo decompression failures
  oma: correctly mark and decrypt partial packets
  oma: check geob tag boundary

Conflicts:
	libavcodec/nuv.c
	libavformat/omadec.c
	tests/ref/fate/nuv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:50:55 +01:00
Michael Niedermayer
1c896e865c Merge commit 'e930b112d14d7acd050d5087d11b6dd4c56a8e4e' into release/0.10
* commit 'e930b112d14d7acd050d5087d11b6dd4c56a8e4e':
  oma: refactor seek function
  8bps: Bound-check the input buffer
  rtmp: Do not misuse memcmp

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:04:29 +01:00
Michael Niedermayer
39d76907c9 Merge commit '067713f15989dd0b8c0888a3b43fd193819a1058' into release/0.10
* commit '067713f15989dd0b8c0888a3b43fd193819a1058':
  rtmp: rename data_size to size
  lavc: set the default rc_initial_buffer_occupancy
  4xm: Reject not a multiple of 16 dimension

Conflicts:
	avconv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:00:15 +01:00
Michael Niedermayer
1825d6d096 Merge commit '12dc01bb1f07112cd7eb31e183d75cb3c0fb92ca' into release/0.10
* commit '12dc01bb1f07112cd7eb31e183d75cb3c0fb92ca':
  4xm: do not overread the prestream buffer

Conflicts:
	libavcodec/4xm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 17:51:21 +01:00
Michael Niedermayer
a5115752ca Merge commit 'cd9b0bb07a66d3299bd62922e9dfa742219abe79' into release/0.10
* commit 'cd9b0bb07a66d3299bd62922e9dfa742219abe79':
  4xm: validate the buffer size before parsing it
  indeo: Do not reference mismatched tiles
  indeo: Sanitize ff_ivi_init_planes fail paths

Conflicts:
	libavcodec/4xm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 17:33:44 +01:00
Michael Niedermayer
cb297f6ae7 Merge commit 'a0b8f85f29883f538a32593bc3c6f712c972ff70' into release/0.10
* commit 'a0b8f85f29883f538a32593bc3c6f712c972ff70':
  indeo: Bound-check before applying motion compensation
  indeo: Bound-check before applying transform
  indeo: reject negative array indexes
  indeo: Cosmetic formatting

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 16:41:04 +01:00
Michael Niedermayer
3667874833 Merge commit 'c5da487a38f93b981c4933d4e0b09c49c319fbb7' into release/0.10
* commit 'c5da487a38f93b981c4933d4e0b09c49c319fbb7':
  indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
  indeo: Refactor ff_ivi_dec_huff_desc

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 16:10:53 +01:00
Reinhard Tartler
ae9652605a Changelog for 0.8.9 2013-11-02 10:31:35 -04:00
Reinhard Tartler
d2f4846591 Prepare for 0.8.7 Release 2013-11-02 10:17:43 -04:00
Diego Biurrun
62c8bf00bb x86: fft: Remove 3DNow! optimizations, they break FATE 2013-10-30 19:19:44 +01:00
Diego Biurrun
a1b82c6b1c x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16
The function accidentally uses mmxext instructions, so it causes sigill
on mmx-only CPUs and provides no benefit on CPUs with mmxext available.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-29 17:03:25 +01:00
Luca Barbato
2ed8a550da aac: Check init_get_bits return value
Some code paths can call it with invalid length.

CC: libav-stable@libav.org
(cherry picked from commit 71953ebcf9)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-28 14:16:37 +01:00
Martin Storsjö
86d0bf0e96 mov: Seek back if overreading an individual atom
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 5b4eb243bc)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/mov.c
2013-10-28 14:16:37 +01:00
Luca Barbato
ef67d8107e aac: return meaningful errors
(cherry picked from commit 07c52e2c7c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/aacdec.c
2013-10-28 14:16:37 +01:00
Anton Khirnov
be8b796f55 vcr1: add sanity checks
Fixes invalid reads with corrupted files.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8aba7968dd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vcr1.c
2013-10-28 14:16:37 +01:00
Luca Barbato
8119336df4 dsicinav: K&R formatting cosmetics
(cherry picked from commit fcae3ff124)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dsicinav.c
2013-10-28 14:16:37 +01:00
Anton Khirnov
8297853917 pictordec: pass correct context to avpriv_request_sample
Fixes invalid reads.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry-picked from commit fe9bb61f9a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pictordec.c
2013-10-28 14:16:37 +01:00
Luca Barbato
b8ba48c725 dsicinav: Clip the source size to the expected maximum
A packet larger than cin->bitmap_size does not make sense.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dsicinav.c
2013-10-28 14:16:37 +01:00
Luca Barbato
1682c9fb59 alsdec: Clean up error paths
Fix at least a memory leak.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/alsdec.c
2013-10-28 14:16:37 +01:00
Reimar Döffinger
5971631d84 ogg: Fix potential infinite discard loop
Seeking in certain broken files would cause ogg_read_timestamp
to fail because ogg_packet would go into a state where all packets
of stream 1 would be discarded until the end of the stream.

Bug-Id: 553
CC: libav-stable@libav.org

Signed-off-by: Jan Gerber <j@v2v.cc>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9a27acae9e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/oggdec.c
2013-10-28 14:16:37 +01:00
Michael Niedermayer
c08127c5e6 avformat/utils: do not override pts in h264 when they are provided from the demuxer
Fixes Ticket2143

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1e5271a9fd)
2013-10-27 19:53:11 +01:00
Michael Niedermayer
558c1f35fa avcodec/h264: reduce noisiness of "mmco: unref short failure"
Do not consider it an error if we have no frames and should discard one.
This condition can easily happen when decoding is started from an I frame

Fixes Ticket2811

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

Conflicts:
	libavcodec/h264_refs.c
2013-10-26 01:27:53 +02:00
Michael Niedermayer
8096691a68 avcodec/h264_refs: modify key frame detection heuristic to detect more cases
Fixes Ticket2968

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

Conflicts:
	libavcodec/h264_refs.c
2013-10-24 11:49:04 +02:00
Luca Barbato
abb41f19cc nuv: Reset the frame on resize
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
36fc320747 nuv: Pad the lzo outbuf
And properly update the buf_size with the correct size.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 075dbc1855)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
4a11d773f9 nuv: check rtjpeg_decode_frame_yuv420 return value
CC: libav-stable@libav.org
(cherry picked from commit 85ac12587b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
c1ebdef01b nuv: Use av_fast_realloc
The decompressed buffer can be used after codec_reinit, so it must be
preserved.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2df0776c22)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
cda26ab21e nuv: Do not ignore lzo decompression failures
Update the fate reference since the last broken frame is not decoded
anymore.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit aae159a7cc)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Anton Khirnov
d2eddcfc83 nuv: return meaningful error codes.
(cherry picked from commit 3344f5cb74)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
3cc05e0d9d oma: correctly mark and decrypt partial packets
Incomplete crypted files would lead to a read after buffer boundary
otherwise.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2219e27b5b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:51 +02:00
Luca Barbato
b98a824c3e oma: check geob tag boundary
Prevent read after buffer boundary on corrupted tag.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9d0b45ade8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:51 +02:00
Luca Barbato
e930b112d1 oma: refactor seek function
Properly propagate seek errors from avio and the generic pcm seek.

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

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:50 +02:00
Luca Barbato
067713f159 rtmp: rename data_size to size
(cherry picked from commit ba5393a609)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rtmppkt.c
	libavformat/rtmpproto.c
2013-10-16 23:05:50 +02:00
Luca Barbato
5312fb8287 8bps: Bound-check the input buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bd7b4da0f4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/8bps.c
2013-10-16 23:05:50 +02:00
Luca Barbato
a9ebc17b2d rtmp: Do not misuse memcmp
CC: libav-stable@libav.org
(cherry picked from commit 5718e3487b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rtmppkt.h
	libavformat/rtmpproto.c
2013-10-16 23:05:50 +02:00
Luca Barbato
2da49df19e lavc: set the default rc_initial_buffer_occupancy
rc_buffer_size is not set before.

Solve the initial the rate control underflow issue reported in
bug 222.

CC: libav-stable@libav.org

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-16 22:54:30 +02:00
Luca Barbato
c25bbb6fdb 4xm: Reject not a multiple of 16 dimension
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2f034f255c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:12 +02:00
Luca Barbato
12dc01bb1f 4xm: do not overread the prestream buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit be373cb50d)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:06 +02:00
Luca Barbato
cd9b0bb07a 4xm: validate the buffer size before parsing it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit de2e5777e2)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:03 +02:00
Luca Barbato
53c76b6803 indeo: Do not reference mismatched tiles
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f9e5261cab)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:48:57 +02:00
Luca Barbato
7999ff8966 indeo: Sanitize ff_ivi_init_planes fail paths
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 28dda8a691)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:48:30 +02:00
Luca Barbato
a0b8f85f29 indeo: Bound-check before applying motion compensation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 25a6666f6c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:41:49 +02:00
Luca Barbato
c02b9e6e63 indeo: Bound-check before applying transform
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dc79685195)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/ivi_common.c
2013-09-29 21:41:12 +02:00
Luca Barbato
efe710f8a0 indeo: reject negative array indexes
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

(cherry picked from commit 6a10142faa)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:39:02 +02:00
Luca Barbato
aedde1a48d indeo: Cosmetic formatting
Trim some overly long lines.

(cherry picked from commit 6dfacd7ab1)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/ivi_common.c
2013-09-29 21:38:28 +02:00
Luca Barbato
c5da487a38 indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
Spin large and mostly self contained blocks into stand alone
functions.

(cherry picked from commit 62256010e9)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:19:17 +02:00
Luca Barbato
f21dce6044 indeo: Refactor ff_ivi_dec_huff_desc
Spare an indentation level.

(cherry picked from commit f6f36ca8ca)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:03:27 +02:00
Mashiat Sarker Shakkhar
89d56f3be1 vc1dec: Do not use random pred_flag if motion vector data is skipped
This fixes SA10143.vc1 from test-suite. Also partially fixes MC-VC1.ts
from videolan streams archive.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 082829520e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 03:03:40 +02:00
Michael Niedermayer
0d1ae06fe9 update for 0.10.9
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f66ecdb1b4 avcodec: add emuedge_linesize_type
Currently all uses of the emu edge code as well as the code itself
assume int linesize
changing some but not changing all would introduce a security issue
once all use this typedef a simple search and replace can be
done to switch them all to ptrdiff_t

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

Conflicts:

	libavcodec/mpegvideo_common.h
	libavcodec/videodsp.h
	libavcodec/videodsp_template.c
	libavcodec/x86/videodsp_init.c
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f6057c5a62 avcodec/ffv1enc: update buffer check for 16bps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3728603f18)

Conflicts:

	libavcodec/ffv1enc.c
(cherry picked from commit c900c6e5c26cd86cf34f9c8d4347cedbd01f3935)
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f3dc3bef4b avcodec/truemotion2: Fix av_freep arguments
Fixes null pointer dereference
Fixes Ticket2944

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

Conflicts:

	libavcodec/truemotion2.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
4a5bb426e2 avcodec/mjpegdec: Add some sanity checks to ljpeg_decode_rgb_scan()
These prevent the rgb ljpeg code from being run on parameters that it doesnt
support. No testcase available but it seems possible to trigger these.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
a99aff4e4b avcodec/dsputil: fix signedness in sizeof() comparissions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 454a11a1c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
9300b1f64e avcodec/pngdsp: fix (un)signed type in end comparission
Fixes out of array accesses
Fixes Ticket2919

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

Conflicts:

	libavcodec/pngdsp.c
2013-09-27 02:52:04 +02:00
Michael Niedermayer
5230f1529a 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 4758e32a6c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:35:00 +02:00
Michael Niedermayer
1a311ad99a jpeg2000: check log2_cblk dimensions
Fixes out of array access
Fixes Ticket2895

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9a271a9368)

Conflicts:

	libavcodec/jpeg2000dec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Conflicts:

	libavcodec/j2kdec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:35:00 +02:00
Michael Niedermayer
ef8145270f avcodec/rpza: Perform pointer advance and checks before using the pointers
Fixes out of array accesses
Fixes Ticket2850

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:18:12 +02:00
Michael Niedermayer
e288124394 avcodec/flashsv: check diff_start/height
Fixes out of array accesses
Fixes Ticket2844

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:18:12 +02:00
Michael Niedermayer
20854f9bff avcodec/parser: reset indexes on realloc failure
Fixes Ticket2982

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 23:24:52 +02:00
Michael Niedermayer
d8af960e7e Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  lavf: fix the comparison in an overflow check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 00:27:46 +02:00
Michael Niedermayer
c8ca385676 Merge commit 'b0ca5fef09d1b1268ea0c8f89bf53cd38aaa85e7' into release/0.10
* commit 'b0ca5fef09d1b1268ea0c8f89bf53cd38aaa85e7':
  dv: Add a guard to not overread the ppcm array
  mpegvideo: Avoid 32-bit wrapping of linesize multiplications
  mjpegb: Detect changing number of planes in interlaced video
  matroskadec: Check that .lang was allocated and set before reading it
  ape demuxer: check for EOF in potentially long loops
  lavf: avoid integer overflow when estimating bitrate
  pictordec: break out of both decoding loops when y drops below 0
  ac3: Return proper error codes

Conflicts:
	libavcodec/pictordec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 00:18:12 +02:00
Michael Niedermayer
c6a4397410 Merge commit '37e69e2dee7c5167083bb42d669f73f038111a79' into release/0.10
* commit '37e69e2dee7c5167083bb42d669f73f038111a79':
  ac3: Clean up the error paths
  ac3: Do not clash with normal AVERROR
  dxa: Make sure the reference frame exists
  h261: check the mtype index
  segafilm: Error out on impossible packet size
  ogg: Always alloc the private context in vorbis_header
  vc1: check mb_height validity.

Conflicts:
	libavcodec/h261dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 23:35:30 +02:00
Michael Niedermayer
210a437e10 Merge commit '54e03863691dcae73260f70108b3731b70773e7c' into release/0.10
* commit '54e03863691dcae73260f70108b3731b70773e7c':
  vc1: check the source buffer in vc1_mc functions
  bink: Bound check the quantization matrix.
  xl: Make sure the width is valid
  alsdec: Fix the clipping range
  dsicinav: Bound-check the source buffer when needed
  mov: Do not allow updating the time scale after it has been set
  ac3dec: Don't consume more data than the actual input packet size
  indeo: Reject impossible FRAMETYPE_NULL

Conflicts:
	libavcodec/alsdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 23:03:08 +02:00
Michael Niedermayer
3308b443f9 Merge commit 'e2dcb8208e8f6cffef58a85127765047f5ef8868' into release/0.10
* commit 'e2dcb8208e8f6cffef58a85127765047f5ef8868':
  indeo5: return proper error codes
  indeo4: Validate scantable dimension

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 22:55:03 +02:00
Michael Niedermayer
91ad27e8f5 Merge commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c' into release/0.10
* commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c':
  indeo4: Check the quantization matrix index
  indeo4: Do not access missing reference MV

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 22:54:14 +02:00
Anton Khirnov
9978c24abf lavf: fix the comparison in an overflow check
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 26f027fba1)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:54:13 -04:00
Luca Barbato
b0ca5fef09 dv: Add a guard to not overread the ppcm array
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7ee191cab0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/dv.c
2013-09-23 19:54:02 -04:00
Martin Storsjö
5473d23ece mpegvideo: Avoid 32-bit wrapping of linesize multiplications
This makes sure that linesize * start_y doesn't overflow, so that
emulated_edge_mc can get back the original value if needed.

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 a711a2cb47)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:53:02 -04:00
Michael Niedermayer
7a9af1da39 mjpegb: Detect changing number of planes in interlaced video
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 af11fa5409)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:52:45 -04:00
Martin Storsjö
068c867286 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 5bcd3ae5b1)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:50:54 -04:00
Anton Khirnov
23f73fc241 ape demuxer: check for EOF in potentially long loops
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry-picked from commit 488b2984fe)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:48:52 -04:00
Anton Khirnov
8d2a86a290 lavf: avoid integer overflow when estimating bitrate
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit df33a58e53)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:47:41 -04:00
Anton Khirnov
5773065a71 pictordec: break out of both decoding loops when y drops below 0
Otherwise picmemset can get called with negative y, resulting in an
invalid write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5f7aecde02)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:46:49 -04:00
Luca Barbato
c225c620c6 ac3: Return proper error codes
(cherry picked from commit b1f9cdc37f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:33 -04:00
Luca Barbato
37e69e2dee ac3: Clean up the error paths
(cherry picked from commit 818d1f1a3e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:22 -04:00
Luca Barbato
3dff283de1 ac3: Do not clash with normal AVERROR
The parsing function return AVERROR and AAC_AC3_PARSE_ERROR values,
make sure they are not misunderstood.

(cherry picked from commit 6258d362b8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:05 -04:00
Luca Barbato
86c169c5b6 dxa: Make sure the reference frame exists
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5ef7c84a93)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dxa.c
2013-09-23 19:43:07 -04:00
Luca Barbato
91355bec88 h261: check the mtype index
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c59967fa7c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/h261dec.c
2013-09-23 19:42:57 -04:00
Luca Barbato
54e0386369 vc1: check the source buffer in vc1_mc functions
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 090cd06311)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vc1dec.c
2013-09-23 19:41:09 -04:00
Luca Barbato
896baaaad8 segafilm: Error out on impossible packet size
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5268bd2900)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
15620c153a ogg: Always alloc the private context in vorbis_header
It is possible to have an initial broken header and then valid packets.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3562684db7)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
75b1b13aff vc1: check mb_height validity.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 43bacd5b7d)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
9c779b5dd0 bink: Bound check the quantization matrix.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9991298f2c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:08 -04:00
Luca Barbato
8006716f21 xl: Make sure the width is valid
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:25:50 -04:00
Luca Barbato
246e0e2c99 alsdec: Fix the clipping range
mcc_weightings is only 32 elements.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:22:22 -04:00
Luca Barbato
0d24adbe8d dsicinav: Bound-check the source buffer when needed
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dd0bfc3a6a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:18:39 -04:00
Martin Storsjö
a593d2e92e mov: Do not allow updating the time scale after it has been set
The time scale is set in mdhd, and later validated in the
enclosing trak atom once all of its children have been parsed.

A loose mdhd atom outside of a trak atom could update the time
scale of the last stream without any validation.

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 31931520df)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:16:04 -04:00
Martin Storsjö
729143e2d2 ac3dec: Don't consume more data than the actual input packet size
This was handled properly in the normal return case at the end
of the function, but not in this special case.

Returning a value larger than the input packet size can cause
problems for certain library users.

Returning the actual input buffer size unconditionally, since
it is not guaranteed that frame_size is set to a sensible
value at this point.

Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8f24c12be7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:14:14 -04:00
Luca Barbato
36921fcdd3 indeo: Reject impossible FRAMETYPE_NULL
A frame marked FRAMETYPE_NULL cannot be scalable and requires a
previous frame successfully decoded.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:11:37 -04:00
Luca Barbato
e2dcb8208e indeo5: return proper error codes
(cherry picked from commit b0eeb9d442)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:09:10 -04:00
Luca Barbato
609345cd5e indeo4: Validate scantable dimension
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cd78e934c2)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 18:54:13 -04:00
Luca Barbato
06c52faef2 indeo4: Check the quantization matrix index
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6255ccf7d5)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 18:53:01 -04:00
Luca Barbato
ba5dfc25ee indeo4: Do not access missing reference MV
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8435bca087)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:

	libavcodec/indeo4.c
2013-09-23 18:52:16 -04:00
Michael Niedermayer
9e552b6512 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  adpcm: Unbreak ima-dk4
  ac3dec: validate channel output mode against channel count
  dca: Respect the current limits in the downmixing capabilities

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:51:05 +02:00
Michael Niedermayer
506ad68d87 Merge commit 'ce3ce08850f1690dff01d9bb4ed6a4274d52771e' into release/0.10
* commit 'ce3ce08850f1690dff01d9bb4ed6a4274d52771e':
  dca: Error out on missing DSYNC
  pcm: always use codec->id instead of codec_id
  mlpdec: Do not set invalid context in read_restart_header
  pcx: Do not overread source buffer in pcx_rle_decode
  wmavoice: conceal clearly corrupted blocks
  iff: Do not read over the source buffer
  qdm2: Conceal broken samples

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:28:52 +02:00
Luca Barbato
ef475620b5 adpcm: Unbreak ima-dk4
Was broken by commit b9dea1a085

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:20:59 +02:00
Michael Niedermayer
a88ed5a481 Merge commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66' into release/0.10
* commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66':
  qdm2: refactor joined stereo support
  adpcm: Write the correct number of samples for ima-dk4
  imc: Catch a division by zero
  atrac3: Error on impossible encoding/channel combinations

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:18:27 +02:00
Luca Barbato
f33d5af1f3 imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/imc.c
2013-09-22 12:16:19 +02:00
Luca Barbato
93c524c0f0 atrac3: Error on impossible encoding/channel combinations
Joint stereo encoded mono is impossible.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-22 12:16:19 +02:00
Luca Barbato
68b1008719 adpcm: Unbreak ima-dk4
Was broken by commit b9dea1a085
2013-09-21 15:33:11 +02:00
Justin Ruggles
763519536b ac3dec: validate channel output mode against channel count
Damaged frames can lead to a mismatch, which can cause a segfault
due to using an incorrect channel mapping.

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

Conflicts:

	libavcodec/ac3dec.c
2013-09-21 15:21:54 +02:00
Luca Barbato
521cbcb7d3 dca: Respect the current limits in the downmixing capabilities
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3802833bc1)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:19:06 +02:00
Luca Barbato
ce3ce08850 dca: Error out on missing DSYNC
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f261e50845)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:17:28 +02:00
Luca Barbato
62c3547539 pcm: always use codec->id instead of codec_id
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c82da343e6)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pcm.c
2013-09-21 15:15:34 +02:00
Luca Barbato
47baf9ca87 mlpdec: Do not set invalid context in read_restart_header
The faulty values rippled further down the codepath causing a
hard-to-track segfault in the assembly code.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/mlpdec.c
2013-09-21 15:14:29 +02:00
Luca Barbato
9c3c08ba98 pcx: Do not overread source buffer in pcx_rle_decode
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3abde1a3b4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:11:27 +02:00
Luca Barbato
9c05debdcd wmavoice: conceal clearly corrupted blocks
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d14a26edb7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:11:18 +02:00
Luca Barbato
195b9f290c iff: Do not read over the source buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7d65e960c7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/iff.c
2013-09-21 15:11:07 +02:00
Luca Barbato
57efb6d94c qdm2: Conceal broken samples
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4ecdb5ed44)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/qdm2.c
2013-09-21 15:08:50 +02:00
Luca Barbato
b64bd2e18b qdm2: refactor joined stereo support
qdm2 does support only two channels. Loop over the run once.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:02:49 +02:00
Michael Niedermayer
cb198f945f Merge commit 'e06623c48030530b50f00cee26f1a3a33c4b4d4b' into release/0.10
* commit 'e06623c48030530b50f00cee26f1a3a33c4b4d4b':
  atrac3: set the getbits context the right buffer_end

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 11:30:23 +02:00
Michael Niedermayer
e27bc85b31 Merge commit '09a098fb8bc7d70a0258b3e8d658833c8d11debe' into release/0.10
* commit '09a098fb8bc7d70a0258b3e8d658833c8d11debe':
  atrac3: fix error handling
  qdm2: check and reset dithering index per channel

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 11:06:02 +02:00
Michael Niedermayer
3f4fb49d1b Merge commit '26589aa81028f42c763c5581a1486a271799890b' into release/0.10
* commit '26589aa81028f42c763c5581a1486a271799890b':
  westwood_vqa: do not free extradata on error in read_header
  vqavideo: check the version
  rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
  avio: Handle AVERROR_EOF in the same way as the return value 0

Conflicts:
	libavcodec/vqavideo.c
	libavformat/westwood_vqa.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 10:59:37 +02:00
Michael Niedermayer
d06dda65b4 Merge commit '139f352daf84e005824562e0e0f36e06ac60ee36' into release/0.10
* commit '139f352daf84e005824562e0e0f36e06ac60ee36':
  wtv: Mark attachment with a negative stream id
  avidec: Let the inner dv demuxer take care of discarding

Conflicts:
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 10:26:56 +02:00
Luca Barbato
b9dea1a085 adpcm: Write the correct number of samples for ima-dk4
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 12576afe20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/adpcm.c
2013-09-13 15:50:41 +02:00
Luca Barbato
90acd3bfe7 imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/imc.c
2013-09-13 15:49:23 +02:00
Luca Barbato
40ee4de6a6 atrac3: Error on impossible encoding/channel combinations
Joint stereo encoded mono is impossible.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:47:43 +02:00
Luca Barbato
e06623c480 atrac3: set the getbits context the right buffer_end
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 22e76ec635)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:44:49 +02:00
Luca Barbato
09a098fb8b atrac3: fix error handling
decode_tonal_components returns a proper AVERROR.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:42:08 +02:00
Luca Barbato
7296ee7af1 qdm2: check and reset dithering index per channel
Checking per subband would have the index exceed the
dithering noise table size.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/qdm2.c
2013-09-13 15:39:06 +02:00
Luca Barbato
26589aa810 westwood_vqa: do not free extradata on error in read_header
The extradata is already freed by avformat_open_input on
failure.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:27:55 +02:00
Luca Barbato
c6942a4b03 vqavideo: check the version
Prevent out of buffer write.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:26:52 +02:00
Michael Niedermayer
fe8b5a37d5 rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
This fixes crashes when playing back certain RealRTSP streams.

When invoked from the RTP depacketizer, the full realmedia
demuxer isn't invoked, but only certain functions from it, where
a separate AVIOContext is passed in as parameter (for the buffer
containing the data to parse). The functions called from within
those entry points should only be using that parameter, not
s->pb. In the depacketizer case, s is the RTSP context, where ->pb
is null.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:26:39 +02:00
Michael Niedermayer
42ad4178fd avio: Handle AVERROR_EOF in the same way as the return value 0
This makes sure the ffurl_read_complete function actually
returns the number of bytes read, as the documentation of the
function says, even if the underlying protocol uses AVERROR_EOF
instead of 0.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5d876be87a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:24:51 +02:00
Luca Barbato
139f352daf wtv: Mark attachment with a negative stream id
A sid 0 would be mismatched to the attachment.

Prevent NULL pointer dereference.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:24:36 +02:00
Luca Barbato
c69b4bdf58 avidec: Let the inner dv demuxer take care of discarding
(cherry picked from commit c8f0b20b4a)

CC: libav-stable@libav.org
2013-09-13 15:24:21 +02:00
Carl Eugen Hoyos
f4392277b0 Avoid a deadlock when decoding wma.
Fixes ticket #2925.
(cherry picked from commit ec8a4841f7)
2013-09-02 10:10:54 +02:00
Michael Niedermayer
49f434ce2e avformat/avidec: match first index and first packet size=0 handling
Fixes Ticket2861

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

Conflicts:
	libavformat/avidec.c
2013-08-31 09:34:06 +02:00
Michael Niedermayer
466911f000 wmaprodec: tighter check for num_vec_coeffs
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b21ba20cc8)

Conflicts:

	libavcodec/wmaprodec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-31 02:30:56 +02:00
Michael Niedermayer
e3e2577794 ffserver: fix order of evaluation bugs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d40c0e4a67)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:57:11 +02:00
Michael Niedermayer
5bb347a3b4 dct-test: fix order of evaluation bug
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dd081f98dd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:56:48 +02:00
Michael Niedermayer
4e17e9f8af update for 0.10.8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:41:57 +02:00
Michael Niedermayer
62d9d4d9d4 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  swfdec: do better validation of tag length
  Changelog for 0.8.8
  kmvc: Clip pixel position to valid range
  kmvc: use fixed sized arrays in the context
  indeo: use a typedef for the mc function pointer
  lavc: check for overflow in init_get_bits
  indeo: check for reference when inheriting mvs
  indeo: use proper error code
  indeo: Properly forward the error codes
  wmapro: error out on impossible scale factor offsets
  wmapro: check the min_samples_per_subframe
  wmapro: return early on unsupported condition
  wmapro: check num_vec_coeffs against the actual available buffer

Conflicts:
	Changelog
	libavformat/swfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:26:30 +02:00
Michael Niedermayer
a3539d26ec Merge commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770' into release/0.10
* commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770':
  wmapro: make sure there is room to store the current packet
  lavc: move put_bits_left in put_bits.h
  4xm: do not overread the source buffer in decode_p_block
  4xm: check bitstream_size boundary before using it
  4xm: reject frames not compatible with the declared version
  4xm: use the correct logging context
  4xm: check the return value of read_huffman_tables().
  4xm: don't rely on get_buffer() initializing the frame.
  vmdav: convert to bytestream2
  smacker: check frame size validity
  smacker: pad the extradata allocation
  smacker: check the return value of smacker_decode_tree
  smacker: fix an off by one in huff.length computation
  Prepare for 0.8.8 Release
  tiff: do not overread the source buffer
  apetag: use int64_t for filesize
  wavpack: return meaningful errors

Conflicts:
	RELEASE
	libavcodec/4xm.c
	libavcodec/vmdav.c
	libavformat/smacker.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 03:56:26 +02:00
Michael Niedermayer
7118358a95 Merge commit '42fed7f433e6d2167ffd4aae31905b583a53b988' into release/0.10
* commit '42fed7f433e6d2167ffd4aae31905b583a53b988':
  wavpack: check packet size early
  mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
  mjpeg: Validate sampling factors
  ljpeg: use the correct number of components in yuv
  wavpack: validate samples size parsed in wavpack_decode_block
  jpegls: check the scan offset
  jpegls: factorize return paths
  jpegls: return meaningful errors
  mjpegdec: properly report unsupported disabled features
  update Changelog
  proresdec: support mixed interlaced/non-interlaced content
  update Changelog
  wav: Always seek to an even offset
  id3v2: check for end of file while unescaping tags
  indeo3: fix off by one in MV validity check
  aac: check the maximum number of channels
  update Changelog
  oggdec: fix faulty cleanup prototype

Conflicts:
	Changelog
	libavcodec/jpeglsdec.c
	libavcodec/mjpegdec.c
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 03:16:38 +02:00
Michael Niedermayer
be90f0279d Merge commit '43c0a87279e717c1384314c6da7155c306ee7c60' into release/0.10
* commit '43c0a87279e717c1384314c6da7155c306ee7c60':
  qdm2: check that the FFT size is a power of 2
  indeo3: switch parsing the header to bytestream2
  indeo3: check motion vectors.
  rv10: check that extradata is large enough
  indeo3: fix data size check
  lavf: make sure stream probe data gets freed.
  dfa: check for invalid access in decode_wdlt().
  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()
  avfiltergraph: check for sws opts being non-NULL before using them.
  oma: Validate sample rates
  Prepare for 0.8.7 Release

Conflicts:
	RELEASE
	libavcodec/indeo3.c
	libavfilter/avfiltergraph.c
	libavformat/utils.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 02:35:24 +02:00
Michael Niedermayer
f3c300d0a4 update all trac links to use the trac subdomain
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 01:30:08 +02:00
Justin Ruggles
e786cc3331 swfdec: do better validation of tag length
Avoids trying to read a packet with 0 or negative size.
Avoids a potential infinite loop due to seeking backwards.

Partially based on a patch by Michael Niedermayer.

(cherry picked from commit e70c5b034c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-07-10 10:25:50 +02:00
Michael Niedermayer
f75964ad1f mpeg12dec: avoid reinitialization on PS changes when possible.
Fixes Ticket2574

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

Conflicts:
	libavcodec/mpeg12dec.c
2013-07-09 00:53:51 +02:00
Reinhard Tartler
8c62082b51 Changelog for 0.8.8 2013-07-07 21:11:35 +02:00
Luca Barbato
79edb9adf6 kmvc: Clip pixel position to valid range
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4e7f0b082d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/kmvc.c
2013-07-07 21:11:35 +02:00
Luca Barbato
e22a5d490d kmvc: use fixed sized arrays in the context
Avoid some boilerplate code to dynamically allocate and then free the
buffers.
(cherry picked from commit 8f68977054)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/kmvc.c
2013-07-07 21:11:35 +02:00
Luca Barbato
c9d8424395 indeo: use a typedef for the mc function pointer
(cherry picked from commit e6d8acf6a8)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-07-07 21:11:34 +02:00
Luca Barbato
e6a365b5d2 lavc: check for overflow in init_get_bits
Fix an undefined behaviour and make the function return a proper
error in case of overflow.

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

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-07 21:11:34 +02:00
Michael Niedermayer
e445dc9237 avformat/mov: Fix duration of fragmented mov
Fixes Ticket2757

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

Conflicts:
	libavformat/mov.c
2013-07-07 18:58:36 +02:00
Michael Niedermayer
c25c89a530 mpegts: only reopen pmt_cb filter if its different from the previous.
Fixes Ticket2632

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b009267910)
2013-07-07 18:56:03 +02:00
Michael Niedermayer
8514e3e08e rmdec: Pass AVIOContext to rm_read_metadata()
Fix null pointer dereference
Fixes Ticket2588

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

Conflicts:
	libavformat/rmdec.c
2013-07-07 18:55:17 +02:00
Luca Barbato
0a1d02ca77 indeo: check for reference when inheriting mvs
The same is done already for qdelta.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:10:18 +02:00
Luca Barbato
7eff48029f indeo: use proper error code
(cherry picked from commit dd3754a488)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/ivi_common.c
2013-07-06 10:10:17 +02:00
Luca Barbato
7658333c17 indeo: Properly forward the error codes
If the tile data size does not match the buffer size it did not
return an AVERROR_INVALIDDATA causing futher corruption later.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/ivi_common.c
2013-07-06 10:10:17 +02:00
Luca Barbato
f16aa5843f wmapro: error out on impossible scale factor offsets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 02ec656af7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:10:17 +02:00
Luca Barbato
bd5ff335ec wmapro: check the min_samples_per_subframe
Must be at least WMAPRO_BLOCK_MIN_SIZE.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wmaprodec.c
2013-07-06 10:10:17 +02:00
Luca Barbato
4ff5167ee7 wmapro: make sure there is room to store the current packet
Prevent horrid and hard to trace struct overwrite.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:06:11 +02:00
Luca Barbato
46e09894ac wmapro: return early on unsupported condition
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6652338f43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wmaprodec.c
2013-07-06 10:06:11 +02:00
Reinhard Tartler
b20004b2e6 lavc: move put_bits_left in put_bits.h
(cherry picked from commit afe03092dd)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/dv.c
2013-07-06 10:06:11 +02:00
Luca Barbato
4e1999ebcb wmapro: check num_vec_coeffs against the actual available buffer
Prevent yet another buffer overwrite.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:06:11 +02:00
Luca Barbato
0c943d1cdd 4xm: do not overread the source buffer in decode_p_block
Check for out of picture macroblocks before calling mcdc.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

(cherry picked from commit 94aefb1932)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:39:08 +02:00
Luca Barbato
6a4f1e784e 4xm: check bitstream_size boundary before using it
Prevent buffer overread.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:25:06 +02:00
Luca Barbato
e5679444fd 4xm: reject frames not compatible with the declared version
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 145023f572)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:25:06 +02:00
Luca Barbato
284ac9191b 4xm: use the correct logging context
(cherry picked from commit 08859d19b4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:19:24 +02:00
Anton Khirnov
e797b7787b 4xm: check the return value of read_huffman_tables().
CC:libav-stable@libav.org
(cherry picked from commit 8097fc9a2d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit bb3f1cad17)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:16:46 +02:00
Anton Khirnov
078e68d261 4xm: don't rely on get_buffer() initializing the frame.
(cherry picked from commit b047c68783)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-30 16:15:04 +02:00
Alexandra Khirnova
9248f789d1 vmdav: convert to bytestream2
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 0afcf97e1e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/vmdav.c
2013-06-30 16:10:46 +02:00
Kostya Shishkov
b40870e636 smacker: check frame size validity
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:34 +02:00
Kostya Shishkov
db0c8061fe smacker: pad the extradata allocation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:32 +02:00
Kostya Shishkov
d7b7b10518 smacker: check the return value of smacker_decode_tree
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:30 +02:00
Kostya Shishkov
e96aaa5622 smacker: fix an off by one in huff.length computation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:26 +02:00
Hendrik Leppkes
5e6135f68d mathops/x86: work around inline asm miscompilation with GCC 4.8.1
The volatile is not required here, and prevents a miscompilation with GCC
4.8.1 when building on x86 with --cpu=i686

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 659df32a9d)
2013-06-24 08:51:25 +02:00
Anton Khirnov
e98f95670b Prepare for 0.8.8 Release 2013-06-22 08:53:39 +02:00
Luca Barbato
42fed7f433 wavpack: check packet size early
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd06291239)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:51:56 +02:00
Luca Barbato
96de1c5ed9 tiff: do not overread the source buffer
At least 2 bytes from the source are read every loop.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/tiff.c
2013-06-22 08:51:56 +02:00
Anton Khirnov
ea7ba1d871 apetag: use int64_t for filesize
CC: libav-stable@libav.org
(cherry picked from commit e816aaacd6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:51:56 +02:00
Luca Barbato
5a6af4fd74 wavpack: return meaningful errors
And forward those that were already meaningful.
(cherry picked from commit 8c34558131)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wavpack.c
2013-06-22 08:51:56 +02:00
Luca Barbato
7ca8d8223d mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
Prevent out of buffer write when decoding broken samples.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:48:37 +02:00
Luca Barbato
33492ad810 mjpeg: Validate sampling factors
They must be non-zero.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/mjpegdec.c
2013-06-22 08:48:24 +02:00
Luca Barbato
da5cf7e452 ljpeg: use the correct number of components in yuv
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a030279a67)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:47:16 +02:00
Luca Barbato
6711d410dc wavpack: validate samples size parsed in wavpack_decode_block
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ed50673066)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wavpack.c
2013-06-22 08:40:13 +02:00
Luca Barbato
d26bc6c6b6 jpegls: check the scan offset
Prevent an out of array bound write.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/jpeglsdec.c
2013-06-22 08:40:02 +02:00
Reinhard Tartler
ca4a25acf8 jpegls: factorize return paths
Conflicts:
	libavcodec/jpeglsdec.c

(cherry picked from commit 4a4107b489)
2013-06-22 08:40:00 +02:00
Luca Barbato
2ebabfff48 jpegls: return meaningful errors
(cherry picked from commit a5a0ef5e13)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/jpeglsdec.c
2013-06-22 08:39:58 +02:00
Luca Barbato
a03dcec364 mjpegdec: properly report unsupported disabled features
When JPEG-LS support is disabled the decoder would feed the
data to the JPEG Lossless decode_*_scan function resulting in
faulty decoding.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:38:31 +02:00
Michael Niedermayer
8ddc9790ed avformat/libmodplug: Reduce the probe score for small input
This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps
Fixes Ticket2583

Based on code by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c605adbf56)
2013-06-21 01:18:23 +02:00
Carl Eugen Hoyos
9ea0f4522f Autodetect idcin only if audio properties allow decoding.
Fixes ticket #2688.
(cherry picked from commit 06bede95fc)
2013-06-19 23:48:28 +02:00
Michael Niedermayer
4abc8e76cb alacenc: Fix missing sign_extend()
Fixes ticket #2497

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8aea2f05dc)
2013-06-13 00:14:25 +02:00
Claudio Freire
dfcf910569 AAC encoder: Fix rate control on twoloop.
Fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.
Now fixed.

Fixes ticket #2625.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Conflicts:
	libavcodec/aaccoder.c

Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2013-06-02 16:35:06 +02:00
Michael Niedermayer
02923b8c78 h264_cavlc: fix reading skip run
Fixes Ticket2606

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

Conflicts:
	libavcodec/h264_cavlc.c
2013-05-30 23:24:19 +02:00
Michael Niedermayer
c8857308f6 smacker: remove av_clip_int16()
Fixes Ticket2425

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2211c76287)
2013-05-21 00:12:50 +02:00
Michael Niedermayer
1c655c1419 avidec: dont randomly skip packets for offseting the index
Fixes Ticket2490

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6c593f1b67)
2013-05-17 22:57:22 +02:00
Carl Eugen Hoyos
d95bb2ac2d Do not read strd chunk in avi files as H264 extradata.
Fixes ticket #2561.
(cherry picked from commit 231b331718)
2013-05-13 16:03:16 +02:00
Reinhard Tartler
e6617580e3 update Changelog 2013-05-12 08:40:56 +02:00
Michael Smith
4941dfb4f6 proresdec: support mixed interlaced/non-interlaced content
Set interlaced to false if we don't have an interlaced frame

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 1fa37f2bfa)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-05-12 08:40:32 +02:00
Reinhard Tartler
2f61e40908 update Changelog 2013-05-11 11:58:32 +02:00
Luca Barbato
31ed79af7f wav: Always seek to an even offset
RIFF chunks are aligned to 16bit according to the specification.

Bug-Id:500
CC:libav-stable@libav.org
(cherry picked from commit ac87eaf856)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-05-07 07:15:26 +02:00
Luca Barbato
f4bb72d33d id3v2: check for end of file while unescaping tags
Prevent an out of buffer bound write.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-05-07 07:13:55 +02:00
Anton Khirnov
6742f0408d indeo3: fix off by one in MV validity check
CC:libav-stable@libav.org
(cherry picked from commit 95220be1fa)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-05-07 07:13:55 +02:00
Reinhard Tartler
a590979988 aac: check the maximum number of channels
Broken bitstreams could report a larger than specified number of
channels and cause outbound writes.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/aacdec.c
2013-05-07 07:13:50 +02:00
Carl Eugen Hoyos
48f0a2c239 Fix type of shared flac table ff_flac_blocksize_table[].
Fixes ticket #2533.
(cherry picked from commit a07ac1f788)
2013-05-05 20:39:42 +02:00
Reinhard Tartler
7bf6a86f2e update Changelog 2013-04-24 21:02:29 +02:00
Anton Khirnov
43c0a87279 qdm2: check that the FFT size is a power of 2
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 34f87a5853)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Luca Barbato
d2d2ddf9a3 oggdec: fix faulty cleanup prototype
(cherry picked from commit fba8e5b608)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
c579d4283e indeo3: switch parsing the header to bytestream2
Also add an additional sanity check to the alt_quant table.
Fixes invalid reads with corrupted files.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
9b2af4d080 indeo3: check motion vectors.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit a0a872d073)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
c5084a1765 rv10: check that extradata is large enough
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit 01d376f598)

Conflicts:

	libavcodec/rv10.c
2013-04-24 21:01:14 +02:00
Anton Khirnov
74753cf1a9 indeo3: fix data size check
The data offsets are relative to the bistream header, which is 16 bytes
after the start of the data.
Fixes invalid reads with corrupted files.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
881526744e lavf: make sure stream probe data gets freed.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dbb1425811)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
4c7f40c6df dfa: check for invalid access in decode_wdlt().
This can happen when the number of skipped lines is not consistent with
the number of coded lines.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
9aa2eee313 xmv: check audio track parameters validity.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d1016dccdc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
0f6364b62b bmv: check for len being valid in bmv_decode_frame().
It can be 0 or -1 for invalid files, which may result in invalid memory
access.

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

Conflicts:

	libavcodec/bmv.c
2013-04-24 21:01:14 +02:00
Anton Khirnov
c65fb5b41b xmv: do not leak memory in the error paths in xmv_read_header()
CC: libav-stable@libav.org
(cherry picked from commit f8080bd13b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
2eaf8698a3 avfiltergraph: check for sws opts being non-NULL before using them.
Avoid snprintfing a NULL pointer.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Luca Barbato
a563e4af9f oma: Validate sample rates
The sample rate index is 3 bits even if currently index 5, 6 and 7 are
not supported.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Reinhard Tartler
73746237a1 Prepare for 0.8.7 Release 2013-04-24 21:01:10 +02:00
James Almer
0b81983461 lavc/bink: Chech for malloc failure
Based on commit 8ab2173ed1
2013-04-07 18:10:05 -03:00
Michael Niedermayer
6f5e1d5811 Update for 0.10.7
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
7ab4358cda rmdec: flush audio packet on seeking
Fixes Ticket1605

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
fdee09a19e doc/APIchanges: List merge commit hashes and version numbers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Diego Biurrun
691017b5c3 configure: Make warnings from -Wreturn-type fatal errors
These warnings have no false positives and point to serious bugs.
(cherry picked from commit 99853cb8d4)

Conflicts:

	configure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
119b7a6c7c oggparsevorbis: fix vorbis_cleanup return type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7a6beedd3f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
4b6b0a164c ffserver: fix return value of add_codec()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff814c75a3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
25d7a33251 apichanges: fix 2 wrong hashes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2f3bc51228)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:34:39 +02:00
Michael Niedermayer
5e2fadeadf apichanges: fix date
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ad6802f975)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:34:39 +02:00
Michael Niedermayer
566de83883 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  update Changelog
  fate: fetch samples that match the release series
  dxva2: include dxva.h if found
  iff: validate CMAP palette size
  Changelog: document msrle bugfix
  Changelog: cosmetics, remove trailing periods and sort
  msrledec: check bounds before constructing a possibly invalid pointer,

Conflicts:
	Changelog
	configure
	libavformat/iff.c
	tests/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:57:13 +02:00
Michael Niedermayer
e9d5a6f1c5 Merge commit '327ff82bac3081d918dceb4931c77e25d0a1480d' into release/0.10
* commit '327ff82bac3081d918dceb4931c77e25d0a1480d':
  msrle: convert MS RLE decoding function to bytestream2.
  Update Changelog for the 0.8.6 Release
  wmaprodec: require block_align to be set.
  ivi_common: do not call MC for intra frames when dc_transform is unset
  roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
  Revert "libmp3lame: use the correct remaining buffer size when flushing"
  lzo: fix overflow checking in copy_backptr()
  flacdec: simplify bounds checking in flac_probe()
  atrac3: avoid oversized shifting in decode_bytes()
  avconv: skip attached files when selecting streams to read from.
  lavf: fix arithmetic overflows in avformat_seek_file()

Conflicts:
	Changelog
	avconv.c
	libavcodec/libmp3lame.c
	libavcodec/msrledec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:42:45 +02:00
Michael Niedermayer
0af8ed29e4 Merge commit 'f82e127dd9c7c0d54bf6400f83c7825e571f9a9e' into release/0.10
* commit 'f82e127dd9c7c0d54bf6400f83c7825e571f9a9e':
  parser: fix large overreads
  dsputil: fix invalid array indexing
  shorten: use the unsigned type where needed
  shorten: report meaningful errors
  shorten: K&R formatting cosmetics
  shorten: set invalid channels count to 0
  matroskadec: request a read buffer for the wav header
  h264: check for luma and chroma bit depth being equal
  vc1: Move init code shared between decoder and parser to common code file.
  libmp3lame: use the correct remaining buffer size when flushing
  xxan: fix invalid memory access in xan_decode_frame_type0()
  wmadec: require block_align to be set.

Conflicts:
	libavcodec/h264.c
	libavcodec/libmp3lame.c
	libavcodec/shorten.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:33:22 +02:00
Michael Niedermayer
a7908ac012 Merge commit '9b79a05289d91d1184455d12e6c4df457f0657c4' into release/0.10
* commit '9b79a05289d91d1184455d12e6c4df457f0657c4':
  wmaprodec: return an error, not 0, when the input is too small.
  vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
  vorbisdec: Error on bark_map_size equal to 0.
  configure: clean up Altivec detection
  Update RELEASE file for 0.8.6
  update year to 2013
  oggdec: make sure the private parse data is cleaned up (cherry picked from commit d894f74762)
  build: Fix CAF demuxer dependencies
  doc: developer: Allow tabs in the vim configuration for Automake files
  doc: filters: Correct BNF FILTER description

Conflicts:
	RELEASE
	cmdutils.c
	libavcodec/vmdav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 14:47:49 +02:00
Michael Niedermayer
9285f25e31 Merge commit '60a1ee6e419e244dc2363fdc4ddf8350d506f2ae' into release/0.10
* commit '60a1ee6e419e244dc2363fdc4ddf8350d506f2ae':
  doc: Fix some obsolete references to av* tools as ff* tools

Conflicts:
	doc/indevs.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 14:43:37 +02:00
Paul B Mahol
1aa50348d8 smacker: fix off by one error
Regression since a93b572ae4.

Fixes #2426.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit e3cc92a623)
2013-04-03 15:17:26 +02:00
Carl Eugen Hoyos
8b72bcba71 Write broken aac frames to mov files instead of skipping them.
Fixes decoding with picky media players.

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

Conflicts:
	libavformat/movenc.c
2013-04-02 12:55:10 +02:00
Carl Eugen Hoyos
5dd5cfd0b8 Only test the first frame for missing aac_adtstoasc bistream filter.
Many players ignore broken aac frames, so don't abort mov or flv
muxing when encountering one, just print a warning instead.

Fixes ticket #2380.
(cherry picked from commit 1741fece70)

Conflicts:
	libavformat/flvenc.c
2013-03-27 01:03:48 +01:00
Reinhard Tartler
b385a77218 update Changelog 2013-03-23 14:48:40 +01:00
Reinhard Tartler
dab40d5bd4 fate: fetch samples that match the release series
The idea is to ensure that 'make fate' always fetches the fate samples
that work with this release.
(cherry picked from commit a89f68776b2771935a348ce07d0a094ae965acfc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-23 14:46:45 +01:00
Ronald S. Bultje
cd534fdf86 dxva2: include dxva.h if found
Apparently, some build environments require dxva.h even for dxva2,
while others lack this header entirely.  Including it conditionally
allows building in both cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit fa84506177)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-19 08:41:24 +01:00
Kostya Shishkov
36aad4f1cc iff: validate CMAP palette size
Fixes CVE-2013-2495

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 31a77177ff)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-18 20:24:49 +01:00
Carl Eugen Hoyos
12e4aefb80 Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested.
Reconfiguring can break x264 lossless encoding.

Fixes ticket #2165.
(cherry picked from commit 75c7e4583f)
2013-03-18 02:21:23 +01:00
Reinhard Tartler
fabdeed6fc Changelog: document msrle bugfix 2013-03-17 08:25:46 +01:00
Reinhard Tartler
f0337b0f24 Changelog: cosmetics, remove trailing periods and sort 2013-03-17 08:25:12 +01:00
Anton Khirnov
4160398e2a msrledec: check bounds before constructing a possibly invalid pointer,
CC:libav-stable@libav.org
(cherry picked from commit 9bd6375d5f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit b7765d00f9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-17 07:37:06 +01:00
Ronald Bultje
327ff82bac msrle: convert MS RLE decoding function to bytestream2.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 992f71e95d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-17 07:36:54 +01:00
Reinhard Tartler
e91a6249b6 Update Changelog for the 0.8.6 Release 2013-03-16 08:48:36 +01:00
Anton Khirnov
b57ab9d7a9 wmaprodec: require block_align to be set.
Avoids an infinite loop in the calling programs with decoder not
consuming any input and not returning output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 20373a66ec)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-16 08:21:01 +01:00
Anton Khirnov
6dbe931344 ivi_common: do not call MC for intra frames when dc_transform is unset
CC:libav-stable@libav.org
(cherry picked from commit 3ba40ebb6c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 74880e78d8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-16 08:21:01 +01:00
Anton Khirnov
87e4f4c79a roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
When there is just 1 byte remanining in the buffer, nothing will be read
and the loop will continue forever. Check that there are at least 8
bytes, which are always read at the beginning.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 747fbe0c21)

Conflicts:

	libavcodec/roqvideodec.c
2013-03-16 08:21:01 +01:00
Reinhard Tartler
ca335f5000 Revert "libmp3lame: use the correct remaining buffer size when flushing"
This reverts commit 5dbb3298b9, which was
mistakenly backported.
2013-03-16 08:20:35 +01:00
Xi Wang
cab9624892 lzo: fix overflow checking in copy_backptr()
The check `src > dst' in the form `&c->out[-back] > c->out' invokes
pointer overflow, which is undefined behavior in C.

Remove the check.  Also replace `&c->out[-back] < c->out_start' with
a safe form `c->out - c->out_start < back' to avoid overflow.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit ca6c3f2c53)

Conflicts:
	libavutil/lzo.c
2013-03-15 13:35:59 +01:00
Xi Wang
d8010bda7a flacdec: simplify bounds checking in flac_probe()
Simplify `p->buf > p->buf + p->buf_size - 4' as `p->buf_size < 4'.
Avoid a possible out-of-bounds pointer, which is undefined behavior
in C.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit 8425d693ee)
2013-03-15 13:33:35 +01:00
Xi Wang
12d8ae2979 atrac3: avoid oversized shifting in decode_bytes()
When `off' is 0, `0x537F6103 << 32' in the following expression invokes
undefined behavior, the result of which is not necessarily 0.

    (0x537F6103 >> (off * 8)) | (0x537F6103 << (32 - (off * 8)))

Avoid oversized shifting.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit eba1ff3130)

Conflicts:
	libavcodec/atrac3.c
2013-03-15 13:33:25 +01:00
Anton Khirnov
0076639965 avconv: skip attached files when selecting streams to read from.
Fixes Bug 473 / invalid reads when using -attach.
2013-03-15 08:58:11 +01:00
Mans Rullgard
d8fbae3c3c lavf: fix arithmetic overflows in avformat_seek_file()
The values compared here can be more than INT64_MAX apart.  Since the
difference is always positive, converting to uint64_t before subtracting
gives the correct result without overflows.

Signed-off-by: Mans Rullgard <mans@mansr.com>

(cherry picked from commit 91ac403b13)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-13 14:14:54 +01:00
Michael Niedermayer
f82e127dd9 parser: fix large overreads
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>

(cherry picked from commit 096abfa150)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-13 13:58:10 +01:00
Mans Rullgard
871c8f0abb dsputil: fix invalid array indexing
Indexing outside an array is invalid and causes errors with
gcc 4.8.

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

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-03-12 23:30:08 +01:00
Luca Barbato
f42d03746a shorten: use the unsigned type where needed
get_uint returns an unsigned value, use an unsigned to store
blocksize to make sure the comparison logic is correct and report
correctly the error for the channel count not supported.

CC: libav-stable@libav.org

(cherry picked from commit 5cf7c72757)
(cherry picked from commit 88089eecfd)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/shorten.c
2013-03-12 20:05:39 +01:00
Luca Barbato
5df064df62 shorten: report meaningful errors
(cherry picked from commit 4c364eb2b8)
(cherry picked from commit 0daf1428e8)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
ff5a06f7f0 shorten: K&R formatting cosmetics
(cherry picked from commit a2ad554def)
(cherry picked from commit 97cc2f286f)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/shorten.c
2013-03-12 20:05:39 +01:00
Michael Niedermayer
a4a97e5f3c shorten: set invalid channels count to 0
Prevent the loop shorten_decode_close from writing and freeing out of
the array boundary.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

CC: libav-stable@libav.org

(cherry picked from commit c10da30d84)
(cherry picked from commit 21d568be17)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
9314af3b2e matroskadec: request a read buffer for the wav header
Solve an infiniloop.

CC: libav-stable@libav.org

(cherry picked from commit 37cb3b180a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
9e48d77158 h264: check for luma and chroma bit depth being equal
The decoder assumes a single bit depth for all the planes while
the specification allows different bit depths for luma and chroma.

Avoid the possible problems described in CVE-2013-2277
2013-03-12 20:05:39 +01:00
Diego Biurrun
b9ec4414b5 vc1: Move init code shared between decoder and parser to common code file.
This fixes standalone compilation of the VC-1 parser.
(cherry picked from commit 3c715383ea)

Conflicts:

	libavcodec/vc1data.h

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-03-10 13:45:43 +01:00
Anton Khirnov
9b79a05289 wmaprodec: return an error, not 0, when the input is too small.
Returning 0 may result in an infinite loop in valid calling programs. A
decoder should never return 0 without producing any output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 60dd8b5733)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Justin Ruggles
5dbb3298b9 libmp3lame: use the correct remaining buffer size when flushing
CC:libav-stable@libav.org
(cherry picked from commit e984f47873)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit b77d9cbbd5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
98406bd26e vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
CC:libav-stable@libav.org
(cherry picked from commit f86d66bcfa)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 77cf052e39)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
e10af023b2 xxan: fix invalid memory access in xan_decode_frame_type0()
The loop a few lines below the xan_unpack() call accesses up to
dec_size * 2 bytes into y_buffer, so dec_size must be limited to
buffer_size / 2.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62a657de16)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Michael Niedermayer
e050af9a80 vorbisdec: Error on bark_map_size equal to 0.
The value is used to calculate output LSP curve and a division by zero
and out of array accesses would occur.

CVE-2013-0894

CC: libav-stable@libav.org

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Found-by: inferno@chromium.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 11dcecfcca)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 494ddd377a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
b527dd30e9 wmadec: require block_align to be set.
Avoids an infinite loop in the calling programs with decoder not
consuming any input and not returning output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit c1f479e8df)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Mans Rullgard
29a2fdb184 configure: clean up Altivec detection
There used to be one test for Altivec intrinsics support and a
separate test to determine which of two possible syntaxes to use
for vector literals.  Since 2008, we only support the more common
of these so the split test no longer makes sense.

This combines the tests into one and also changes the hard error on
failure to a warning.  The test can reasonably fail if no --cpu flag
is provided (or is provided with an unknown CPU) and the compiler
default target does not support Altivec.  Aborting in this case is
probably over-reacting.

Fixes: #464, http://bugs.debian.org/701710

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Reinhard Tartler
30bfa9e79f Update RELEASE file for 0.8.6 2013-03-09 18:54:28 +01:00
Reinhard Tartler
cb93705900 update year to 2013
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:27 +01:00
Luca Barbato
8829c79039 oggdec: make sure the private parse data is cleaned up
(cherry picked from commit d894f74762)

Related to CVE-2012-2882

Conflicts:

	libavformat/oggdec.h
	libavformat/oggparsevorbis.c
2013-03-09 18:54:27 +01:00
Carl Eugen Hoyos
85e082d081 Require at least three frames to autodetect loas.
(cherry picked from commit a60530e3ee)
2013-03-02 02:05:14 +01:00
Nicolas George
eeacc5a7d0 lavf/avio: check for : in filenames for protocols.
If the first "special" character in a filename is a comma,
it can introduce protocol options, but only if there is a
colon at the end. Otherwise, it is just a filename with a
comma.

Fix trac ticket #2303.
(cherry picked from commit d9fad53f4b)
2013-03-01 08:59:38 +01:00
Diego Biurrun
6a9f050c22 build: Fix CAF demuxer dependencies
(cherry picked from commit a519463366)

Conflicts:

	libavcodec/Makefile
2013-02-25 20:34:26 +01:00
Vicente Jimenez Aguilar
60a1ee6e41 doc: Fix some obsolete references to av* tools as ff* tools
Signed-off-by: Diego Biurrun <diego@biurrun.de>

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-02-24 19:32:52 +01:00
Diego Biurrun
c3829f7085 doc: developer: Allow tabs in the vim configuration for Automake files
While we do not use Automake in libav, this allows our config to be
used more globally without introducing unwanted breakage.
(cherry picked from commit 040c565e51)

Conflicts:

	doc/developer.texi
2013-02-24 19:32:52 +01:00
Vicente Jimenez Aguilar
f20764102b doc: filters: Correct BNF FILTER description
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit b5ad422bf4)
2013-02-24 19:32:52 +01:00
Carl Eugen Hoyos
8344601712 Write the fiel atom to mov files independently of the used video coded.
The QuickTime specification does not contain any hint that the atom
must not be written in some cases and both the QuickTime and the
AVID decoders do not fail if the atom is present.

This change allows to signal (visually) interlaced streams with
a codec different from uncompressed video.

As a side-effect, this fixes ticket #2202
(cherry picked from commit 7d0e3b197c)

Conflicts:
	libavformat/movenc.c
	tests/ref/lavf/mov
	tests/ref/seek/lavf_mov
	tests/ref/vsynth/vsynth1-avui
	tests/ref/vsynth/vsynth1-dnxhd-1080i
	tests/ref/vsynth/vsynth1-mpeg4
	tests/ref/vsynth/vsynth2-avui
	tests/ref/vsynth/vsynth2-dnxhd-1080i
	tests/ref/vsynth/vsynth2-mpeg4
2013-02-14 15:47:23 +01:00
Michael Niedermayer
5b7f7f3809 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  pthread: set the frame properties from the thread context, not user.
  mp3: exit on parsing error in mp_decode_frame
  indeo3: initialise pixel planes on allocation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:56 +01:00
Michael Niedermayer
b07c791252 huffyuvdec: Skip len==0 cases
Fixes vlc decoding for hypothetical files that would contain such cases.

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

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

Conflicts:

	libavcodec/huffyuv.c
(cherry picked from commit 9bc70fe1ae50fd2faa0b9429d47cfbda01a92ebc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Michael Niedermayer
ba4b57e802 huffyuvdec: Check init_vlc() return codes.
Prevents out of array writes

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

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

Conflicts:

	libavcodec/huffyuv.c
(cherry picked from commit 277def59fce10d91e3113e5c0f63e22bc4abfa88)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
ef953f760e rtmp: fix buffer overflows in ff_amf_tag_contents()
A negative `size' will bypass FFMIN().  In the subsequent memcpy() call,
`size' will be considered as a large positive value, leading to a buffer
overflow.

Change the type of `size' to unsigned int to avoid buffer overflow, and
simplify overflow checks accordingly.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4e692374f7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
69b3fedc09 rtmp: fix multiple broken overflow checks
Sanity checks like `data + size >= data_end || data + size < data' are
broken, because `data + size < data' assumes pointer overflow, which is
undefined behavior in C.  Many compilers such as gcc/clang optimize such
checks away.

Use `size < 0 || size >= data_end - data' instead.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 902cfe2f74)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
165f783235 rtpenc: fix overflow checking in avc_mp4_find_startcode()
The check `start + res < start' is broken since pointer overflow is
undefined behavior in C.  Many compilers such as gcc/clang optimize
away this check.

Use `res > end - start' instead.  Also change `res' to unsigned int
to avoid signed left-shift overflow.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2f014567cf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Carl Eugen Hoyos
7a21b089c2 sws: dont write out of array on bigendian
Fixes Ticket2229

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4e2c63685e)
2013-02-14 14:42:41 +01:00
Michael Niedermayer
4d9bde86d0 ffmpeg: dont allow -flags to override -pass
Fixes Ticket2154

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

Conflicts:
	ffmpeg_opt.c
2013-02-06 10:23:45 +01:00
Anton Khirnov
a4c9260e69 pthread: set the frame properties from the thread context, not user.
Right now, the frame properties are set from the user-facing
AVCodecContext before it is updated from the thread context, which is
wrong since they may be invalid or obsolete.
2013-01-24 11:45:27 +01:00
Carl Eugen Hoyos
4e869e7a5f matroskaenc: add codec_tag lists back.
This reverts 312645e :
"Do not set codec_tag property for matroska muxers."

Also adds dummy codec_tag lists with codecs
supported in mkv but not in wav / avi.

Fixes ticket #2169.
(cherry picked from commit df39c3ce38)

Conflicts:
	libavformat/matroskaenc.c
2013-01-24 02:42:38 +01:00
Luca Barbato
1076ea8115 mp3: exit on parsing error in mp_decode_frame
Properly forward mp_decode_layer3 errors, mp_decode_layer1 and
mp_decode_layer2 do not return errors.

Based on a patch by Michael Niedermayer.
(cherry picked from commit 0c03cc6838)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-01-20 20:36:57 +01:00
Kostya Shishkov
a94f789c33 indeo3: initialise pixel planes on allocation
This prevents decoder from reading garbage from it in case of errors later.
(cherry picked from commit 81064a8045)

Fixes an invalid read on sample from CVE-2012-2804

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-01-20 20:36:57 +01:00
Carl Eugen Hoyos
74b04e6a35 Fix detection of struct v4l2_frmsize_discrete.
It was always detected successfully.
(cherry picked from commit 91e016865c)
2013-01-17 02:45:20 +01:00
Michael Niedermayer
492eb0aa14 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog
  h264: check ref_count validity for num_ref_idx_active_override_flag
  h264: check context state before decoding slice data partitions
  oggdec: free the ogg streams on read_header failure
  oggdec: check memory allocation
  Fix uninitialized reads on malformed ogg files.
  rtsp: Recheck the reordering queue if getting a new packet
  opt: avoid segfault in av_opt_next() if the class does not have an option list
  alacdec: do not be too strict about the extradata size

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 02:33:07 +01:00
Michael Niedermayer
c961ce969a Merge commit 'a335ffd7f4cdaaa6a8fe4187f6f06b0418eea19a' into release/0.10
* commit 'a335ffd7f4cdaaa6a8fe4187f6f06b0418eea19a':
  h264: fix sps parsing for SVC and CAVLC 4:4:4 Intra profiles
  h264: check sps.log2_max_frame_num for validity
  h264: slice-mt: get last_pic_dropable from master context
  ppc: always use pic for shared libraries
  h264: error out on unset current_picture_ptr for h->current_slice > 0
  flashsv: make sure data for zlib priming is available
  h264: enable low delay only if no delayed frames were seen
  flashsv: check for keyframe before using differential coding
  lavf: avoid integer overflow in ff_compute_frame_duration()
  aacdec: Fix an off-by-one overwrite when switching to LTP profile from MAIN.
  APIchanges: Fill in missing commit hashes

Conflicts:
	doc/APIchanges

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 02:20:20 +01:00
Michael Niedermayer
52cea9ce92 Merge commit '01a4e7f623a2e6dc95862f9a56c777f058d7bfaf' into release/0.10
* commit '01a4e7f623a2e6dc95862f9a56c777f058d7bfaf':
  lavf: Bump minor version to distinguish branch and master version numbers
  vp6: properly fail on unsupported feature
  mp3: properly forward mp_decode_frame errors
  mpeg12: do not decode extradata more than once.
  indeo3: when freeing buffers, set pointers referencing them to NULL as well
  indeo3: ensure that decoded cell data is in 7-bit range as presumed by decoder
  avconv: fix copying per-stream metadata.
  id3v2: fix reading unsynchronized frames.
  h264: Fix parameters to ff_er_add_slice() call
  build: fix 'clean' target

Conflicts:
	avconv.c
	libavcodec/mpeg12.h
	libavformat/id3v2.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 01:58:54 +01:00
Carl Eugen Hoyos
4fc22e85c0 Revert "x86: Require an assembler able to cope with AVX instructions"
This reverts commit e287201c77.
2013-01-17 01:51:28 +01:00
Michael Niedermayer
ea3b68c99d Merge commit 'dcf8f259d107838ff3778343dcb762398130a1a3' into release/0.10
* commit 'dcf8f259d107838ff3778343dcb762398130a1a3':
  build: Add 'check' target to run all compile and test targets.
  Ignore generated aviocat tool.
  avconv: only apply presets when we have an encoder.
  flacenc: ensure the order is within the min/max range in LPC order search
  yuv4mpeg: reject unsupported codecs
  vp8: reset loopfilter delta values at keyframes.
  vp56: release frames on error
  vp56: make parse_header return standard error codes
  ivi_common: check that scan pattern is set before using it.
  Prepare for 0.8.5 Release
  x86: Require an assembler able to cope with AVX instructions

Conflicts:
	RELEASE
	avconv.c
	doc/developer.texi
	libavformat/yuv4mpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 01:29:26 +01:00
Reinhard Tartler
cf2cab5b2a Update Changelog 2013-01-12 17:59:41 +01:00
Janne Grunau
adef01c370 h264: check ref_count validity for num_ref_idx_active_override_flag
Fixes segfault in the fuzzed sample bipbop234.ts_s226407.
CC: libav-stable@libav.org
(cherry-picked from commit 6e5cdf2628)
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2013-01-12 17:59:41 +01:00
Janne Grunau
06312bbb10 h264: check context state before decoding slice data partitions
Fixes mov_h264_aac__Demo_FlagOfOurFathers.mov.SIGSEGV.4e9.656.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:41 +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 89b51b570d)

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

Conflicts:

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

Conflicts:

	libavformat/oggdec.c
2013-01-12 17:59:41 +01:00
Victor Lopez
a335ffd7f4 h264: fix sps parsing for SVC and CAVLC 4:4:4 Intra profiles
Fixes bug 396.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +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 ef0d779706)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
f620c12067 h264: check sps.log2_max_frame_num for validity
Fixes infinite or long taking loop in frame num gap code in
the fuzzed sample bipbop234.ts_s223302.

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

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 8729698d50)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
1d98811b95 h264: slice-mt: get last_pic_dropable from master context
Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from
https://github.com/OpenELEC/OpenELEC.tv/issues/1557 .

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Justin Ruggles
dfb7a638e6 opt: avoid segfault in av_opt_next() if the class does not have an option list
CC: libav-stable@libav.org
(cherry picked from commit d02202e08a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Luca Barbato
6b70965f39 ppc: always use pic for shared libraries
CC: libav-stable@libav.org
(cherry picked from commit 1944d532a8)

Conflicts:

	configure
2013-01-12 17:59:40 +01:00
Justin Ruggles
77e6676d3e alacdec: do not be too strict about the extradata size
Sometimes the extradata has duplicate atoms, but that shouldn't prevent
decoding. Just ensure that it is at least 36 bytes as a sanity check.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
f1b3cc02ec h264: error out on unset current_picture_ptr for h->current_slice > 0
Fixes a segfault with fuzzed sample sample_varPAR_s11622_r001-02.avi.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
b6592b402c flashsv: make sure data for zlib priming is available
Fixes a segfault in the fuzzed sample resolutionchange.flv_s314809.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
6cd92c3880 h264: enable low delay only if no delayed frames were seen
Dropping frames is undesirable but that is the only way by which the
decoder could return to low delay mode. Instead emit a warning and
continue with delayed frames.
Fixes a crash in fuzzed sample nasa-8s2.ts_s20033 caused by a larger
than expected has_b_frames value. Low delay keeps getting re-enabled
from a presumely broken SPS.

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

Conflicts:

	libavcodec/h264.c
2013-01-12 17:59:40 +01:00
Janne Grunau
522e97bd9e flashsv: check for keyframe before using differential coding
Fixes a segfault in te fuzzed sample resolutionchange.flv_s211713.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +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 7709ce029a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +01:00
Alex Converse
a4a63bf5b5 aacdec: Fix an off-by-one overwrite when switching to LTP profile from MAIN.
Found-by: pawlkt
CC: libav-stable@libav.org
Fixes: CVE-2012-5144
(cherry picked from commit 6d5b009267)

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
Diego Biurrun
bb35a42e93 APIchanges: Fill in missing commit hashes 2013-01-10 20:51:45 +01:00
Piotr Bandurski
fe0e64ca64 tiffdec: Use the correct height field.
Fixes Ticket913

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

Conflicts:
	libavcodec/tiff.c
2013-01-07 00:34:31 +01:00
Luca Barbato
3e700cc66b vp6: properly fail on unsupported feature
Interlacing is not supported at all and mismanaged down the normal
codepaths causing possible buffer management issues.

Fixes: CVE-2012-2783
(cherry picked from commit be75fed975)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 12:02:22 +01:00
Luca Barbato
a5290800f5 mp3: properly forward mp_decode_frame errors
The function can return either a parsing error or a memory management
error.

Fixes: CVE-2012-2797

(cherry picked from commit 9ab0874ea8)

Conflicts:

	libavcodec/mpegaudiodec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 11:49:25 +01:00
Anton Khirnov
56c1e18a52 mpeg12: do not decode extradata more than once.
Fixes CVE-2012-2803.

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

Conflicts:

	libavcodec/mpeg12.c
2013-01-05 00:35:58 +01:00
Kostya Shishkov
c55ca98769 indeo3: when freeing buffers, set pointers referencing them to NULL as well
Related to CVE-2012-2804
(cherry picked from commit bc00da2701)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:27:34 +01:00
Kostya Shishkov
e5ea6539d4 indeo3: ensure that decoded cell data is in 7-bit range as presumed by decoder
Related to CVE-2012-2804
(cherry picked from commit fc417db3f1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:26:25 +01:00
Anton Khirnov
f65ec488a9 avconv: fix copying per-stream metadata.
It is handled separately from other types because it uses stream
specifiers and currently that triggers an assert in SET_DICT.

(cherry picked from commit 4632abc7a3)

Conflicts:

	avconv_opt.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +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 9ae80e6a9c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Janne Grunau
52adbc0e17 h264: Fix parameters to ff_er_add_slice() call
s->mb_x is reset to zero a couple of lines above. It does not make
sense to call ff_er_add_slice() with 0 as endx when the end of the
macroblock row was reached. Fixes unnecessary and counterproductive
error resilience in https://bugzilla.libav.org/show_bug.cgi?id=394.

(cherry picked from commit e6160bda98)

Conflicts:

	libavcodec/h264.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Diego Biurrun
26b177b8f7 build: fix 'clean' target
This fixes removal of TOOLS as well as HOSTPROGS declared in the
top-level Makefile.  The clean target in common.mak needs to be
eval'd since the variables used within are reset for each library.

(cherry picked from commit 395c3feb3b)

Conflicts:

	common.mak
	library.mak

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:30:45 +01:00
Diego Biurrun
dcf8f259d1 build: Add 'check' target to run all compile and test targets.
(cherry picked from commit 4982e1ddfa)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:21:39 +01:00
Diego Biurrun
576834b08e Ignore generated aviocat tool.
(cherry picked from commit 50639cbefe)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:20:12 +01:00
Anton Khirnov
50b8e4c8fd avconv: only apply presets when we have an encoder.
Fixes a crash when using a preset with stream copy.
(cherry picked from commit 4e61a38aa0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:55:27 +01:00
Justin Ruggles
0ba0e31955 flacenc: ensure the order is within the min/max range in LPC order search
This fixes use of uninitialized values when the FLAC encoder uses the
2-level, 4-level, and 8-level search methods. Fixes failure of the
fate-flac-24-comp-8 test when run using valgrind.
(cherry picked from commit 3a2731cbd3)

Conflicts:

	libavcodec/flacenc.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:44: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 424b1e7642)

Conflicts:

	libavformat/yuv4mpeg.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:34:08 +01:00
Sami Pietila
9837f19693 vp8: reset loopfilter delta values at keyframes.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>

(cherry picked from commit 0bf511d579)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:29:41 +01:00
Luca Barbato
211badf068 vp56: release frames on error
Fixes CVE-2012-2783

CC: libav-stable@libav.org

(cherry picked from commit f33b5ba63e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:28:18 +01:00
Luca Barbato
145317d220 vp56: make parse_header return standard error codes
Returning 0 for failure is misleading.

CC: libav-stable@libav.org

(cherry picked from commit bb675d3ac6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:28:08 +01:00
Anton Khirnov
3fca5799c6 ivi_common: check that scan pattern is set before using it.
Fixes CVE-2012-2791.

CC: libav-stable@libav.org

(cherry picked from commit deabb52ab4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:25:32 +01:00
Reinhard Tartler
398d4e8669 Prepare for 0.8.5 Release 2013-01-02 20:08:49 +01:00
Clément Bœsch
c3d7c805bc lavc/ass_split: check for NULL pointer in ff_ass_split_override_codes().
This is consistent with the other ff_ass_split_* functions.

It also fixes a crash when trying to split a dialog with text=NULL
(which seems to happen when the text of the dialog is empty); basically,
this commit fixes crashes when trying to encode an empty text subtitle
dialog (see subrip and mov_text encoders).

Fixes Ticket2048.
(cherry picked from commit c83002a4f8)
2013-01-01 18:22:20 +01:00
Michael Niedermayer
cdb376d775 mpeg1video: fix regression with slices != threads
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a01679586c)
2012-12-13 00:26:08 +01:00
Michael Niedermayer
6773269f4c mpeg1video: support multi threaded slice encoding.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03df972016)

Conflicts:
	libavcodec/mpeg12enc.c
2012-12-13 00:25:48 +01:00
Michael Niedermayer
2a42b680e9 avidec: try to support oddly muxed MMES stream
Fixes ticket1804

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit be89693ddc)
2012-12-10 01:00:31 +01:00
Michael Niedermayer
f1156fdc02 riff: ignore ff_read_riff_info() failure.
Some files simply contain invalid info tags.
Fixes unrelated bug posted into Ticket1821

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 09456d0df1)
2012-12-10 00:48:15 +01:00
Michael Niedermayer
1a5b7ce0ea riff: retry reading metadata without padding if it fails with
Fixes Ticket1821

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d0c27e88d2)
2012-12-10 00:48:13 +01:00
Janne Grunau
213f651498 h264: slice-mt: get last_pic_dropable from master context
Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from
https://github.com/OpenELEC/OpenELEC.tv/issues/1557 .
(cherry picked from commit 24c62ea7a5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-06 16:22:49 +01:00
Diego Biurrun
e287201c77 x86: Require an assembler able to cope with AVX instructions
All modern assemblers have this capability.  Older NASM versions
that lack the capability produce code that crashes at runtime,
so it's better to error out during the build process instead.

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

Conflicts:

	configure
2012-11-11 22:41:46 +01:00
Michael Niedermayer
36982b3616 Update for 0.10.6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:43:19 +02:00
Michael Niedermayer
5b5e61a0bf noise_bsf: fix division by 0
Fixes CID733737
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93ef29b6f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Thilo Borgmann
7f1fb8d2a3 alsdec: fix clipping of weightings for MCC decoding
Fixes CID717905
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit feaff427c0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
75a11e950f mpegvideo: fix motion_val checks
Fixes CID604124
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 20ec0d2a75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
e6fa08f14e flashsv: check deflateInit() return value
Fixes CID703620
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3eb4f54c0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
400b23beab dnxhddata_ Fix mixup of sizeof() and array elements in ff_dnxhd_find_cid()
Fixes CID717910
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1037e484f0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
cff9f07d39 ffv1: make sure gob_count is not 0
Fixes division by 0
Fixes CID733736

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
de4606a5b7 pp: avoid overflow in w*h
Fixes CID700580
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3689ec3d28)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
93a0dd8358 ffeval: avoid folding EOF onto a valid char
Fixes CID733704
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 225d3cc1cc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
12801f969b trasher: check seek return value.
Fixes CID733726
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8ab0b9caba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:45 +02:00
Michael Niedermayer
35b15a0da8 jpegls: increase run_index to 4
Fixes part of CID717913
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8dc8994427)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:44 +02:00
Michael Niedermayer
fa73f547a0 jpegls: fix off limit
Fixes part of CID717913
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4acfe3d193)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:42 +02:00
Michael Niedermayer
c09b4dde37 wtvdec: fix memleak on error
Fixes CID718002
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e47024d72f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:41 +02:00
Michael Niedermayer
db4903f4e4 ffv1: avoid checking a double for equality
if 0.0 != 0.0 a out of array read would occur, equal checks
with floating point may behave in such odd ways, though
this is very unlikely in a real implementation of a compiler

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:40 +02:00
Michael Niedermayer
7a0e5a63d0 vf_fade: fix memleaks of args
Fixes: CID718989
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f374e9989b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:39 +02:00
Michael Niedermayer
3038e2041e ffserver: prevent nb_streams from becoming too large
Fixes CID732249

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:37 +02:00
Michael Niedermayer
8b64036038 aacsbr: change order of operation to prevent out of array read
Fixes CID732250
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c2340831b8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:36 +02:00
Michael Niedermayer
f2d56c2eeb motion_est: more complete SAB diamond size check
This makes no difference with the current #defines

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:42 +02:00
Paul B Mahol
46c1e5de58 yop: check return value of avformat_new_stream()
Fixes null pointer dereference, fixes CID703729.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 3d179edf6d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:40 +02:00
Paul B Mahol
e6dfaf7bb8 truemotion2: remove unreachable code
Fixes CID610345.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit caa7e24eb1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:39 +02:00
Paul B Mahol
c9df500190 bmp: unbreak non BMP_RGB compression for v4 and v5
Fixes CID733728 & CID733729.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 313b40efbd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:27 +02:00
Michael Niedermayer
d12bf6fc9e libvpxenc: fix memleak on error path
Fixes CID733795
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 104b1d9e10)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:22 +02:00
Michael Niedermayer
8a525e4d18 av_tempfile: fix leak in error case
Fixes CID733796 Part2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c9454cb643)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:21 +02:00
Michael Niedermayer
7450a0215a ffprobe: fix use of uninitialized pointer in av_strtok()
Fixes CID733837
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4334ba043e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:14 +02:00
Michael Niedermayer
ba10ea845f asrc_aevalsrc: Fix use of uninitialized pointer inside av_strtok()
Fixes CID733842
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 989c91b504)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:12 +02:00
Michael Niedermayer
0b9d464348 swscale-test: fix freeing of uninitialized variable
Fixes: CID733844
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fac1ccbda1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:11 +02:00
Janne Grunau
c279e37e90 flashsv: propagate inflateReset() errors
Fixes CID717493.
(cherry picked from commit c466eb1746)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:10 +02:00
Janne Grunau
cc88dacc1a g722enc: fix size argument in memset
Fixes CID700725.
(cherry picked from commit f1de23faaa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:07 +02:00
Michael Niedermayer
988910a277 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  svq3: replace unsafe pointer casting with intreadwrite macros
  Update Changelog for the 0.8.4 Release
  lavc: remove stats_out from the options table.
  Prepare for 0.8.4 Release
  tiffenc: Check av_malloc() results.
  mpegaudiodec: fix short_start calculation
  h264: avoid stuck buffer pointer in decode_nal_units
  vf_pad/scale: use double precision for aspect ratios.
  yuv4mpeg: return proper error codes.
  smacker audio: sign-extend the initial 16-bit predicted value

Conflicts:
	Changelog
	RELEASE
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 17:18:59 +02:00
Michael Niedermayer
d6a55ab016 Merge commit 'be209bdabb11c59de17220bdbf0bf9c9f7cc16f5' into release/0.10
* commit 'be209bdabb11c59de17220bdbf0bf9c9f7cc16f5':
  vf_pad: don't give up its own reference to the output buffer.
  libvorbis: use VBR by default, with default quality of 3
  libvorbis: fix use of minrate/maxrate AVOptions
  h264: fix deadlocks on incomplete reference frame decoding.
  cmdutils: avoid setting data pointers to invalid values in alloc_buffer()
  avidec: return 0, not packet size from read_packet().
  wmapro: prevent division by zero when sample rate is unspecified
  vc1dec: check that coded slice positions and interlacing match.
  alsdec: fix number of decoded samples in first sub-block in BGMC mode.
  alsdec: remove dead assignments
  alsdec: Fix out of ltp_gain_values read.
  alsdec: Check that quantized parcor coeffs are within range.
  alsdec: Check k used for rice decoder.

Conflicts:
	avconv.c
	libavcodec/h264.c
	libavcodec/libvorbis.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 17:02:46 +02:00
Michael Niedermayer
36487066ee Merge commit '15c2e8027f4827018608badb1bff1294af1810e4' into release/0.10
* commit '15c2e8027f4827018608badb1bff1294af1810e4':
  wav: do not fail on empty INFO tags
  cavsdec: check for changing w/h.
  indeo4: update AVCodecContext width/height on size change
  avidec: use actually read size instead of requested size
  wmaprodec: check num_vec_coeffs for validity
  lagarith: check count before writing zeros.
  indeo3: fix out of cell write.
  indeo5: check tile size in decode_mb_info().
  indeo5: prevent null pointer dereference on broken files
  indeo5dec: Make sure we have had a valid gop header.
  indeo4/5: check empty tile size in decode_mb_info().
  ivi_common: make ff_ivi_process_empty_tile() static.

Conflicts:
	libavcodec/indeo5.c
	libavformat/wav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 16:29:54 +02:00
Michael Niedermayer
fe8243d7a9 Merge commit 'c5ec1908597824e93bbe20137ac9662f84f3cb07' into release/0.10
* commit 'c5ec1908597824e93bbe20137ac9662f84f3cb07':
  indeo: check for invalid motion vectors
  indeo: clear allocated band buffers
  indeo: track tile macroblock size
  factor out common decoding code for Indeo 4 and Indeo 5
  indeo: check custom Huffman tables for errors
  dfa: improve boundary checks in decode_dds1()
  dfa: use more meaningful return codes
  dfa: add some checks to ensure that decoder won't write past frame end
  dfa: convert to bytestream2 API
  dfa: check that the caller set width/height properly.
  avsdec: Set dimensions instead of relying on the demuxer.
  ac3dec: ensure get_buffer() gets a buffer for the correct number of channels

Conflicts:
	libavcodec/avs.c
	libavcodec/dfa.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 16:17:41 +02:00
Mans Rullgard
6365b43295 svq3: replace unsafe pointer casting with intreadwrite macros
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-23 16:38:52 +02:00
Reinhard Tartler
2c8ce46250 Update Changelog for the 0.8.4 Release 2012-10-22 20:32:41 +02:00
Anton Khirnov
a0f6c93f52 lavc: remove stats_out from the options table.
Since it is declared as a string AVOption, the generic freeing code
attempts to free it on codec close. Some codecs might have already freed
it elsewhere (or didn't even allocate it with av_malloc() in the first
place), so this might lead to an invalid free.

There is no point in having this field accessible as an AVOption, so
remove it from the options table.

Fixes Bug 380.

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

Conflicts:

	libavcodec/options_table.h
2012-10-22 18:51:50 +02:00
Reinhard Tartler
ca8c814970 Prepare for 0.8.4 Release 2012-10-19 19:23:14 +02:00
Alex Converse
8076d32f30 tiffenc: Check av_malloc() results.
(cherry picked from commit b92dfb56d4)

Conflicts:

	libavcodec/tiffenc.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Luca Barbato
0f3381ad5b mpegaudiodec: fix short_start calculation
The value should be always 3, as it follows from the specification.

Fix a stack buffer overflow in exponents_from_scale_factors as reported
by asan. Thanks to Dale Curtis for the sample vector.
(cherry picked from commit 97cfa55eea)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Jindřich Makovička
9822e3aa52 h264: avoid stuck buffer pointer in decode_nal_units
When decode_nal_units() previously encountered a NAL_END_SEQUENCE,
and there are some junk bytes left in the input buffer, but no start codes,
buf_index gets stuck 3 bytes before the end of the buffer.

This can trigger an infinite loop in the caller code, eg. in
try_decode_trame(), as avcodec_decode_video() then keeps returning zeroes,
with 3 bytes of the input packet still available.

With this change, the remaining bytes are skipped so the whole packet gets
consumed.

CC:libav-stable@libav.org

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 1a8c6917f6)

Conflicts:

	libavcodec/h264.c
2012-10-19 19:23:14 +02:00
Anton Khirnov
0b923a2b72 vf_pad/scale: use double precision for aspect ratios.
Fixes Bug 203.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Anton Khirnov
d792be5681 yuv4mpeg: return proper error codes.
Fixes Bug 373.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Franz Brauße
443f1463c0 smacker audio: sign-extend the initial 16-bit predicted value
Fixes Bug #265

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 12cbbbb4ab)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 11:13:05 +02:00
Anton Khirnov
be209bdabb vf_pad: don't give up its own reference to the output buffer.
Conflicts:
	libavfilter/vf_pad.c

Fixes Bug 245

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 11:06:57 +02:00
Justin Ruggles
24025cc0b9 libvorbis: use VBR by default, with default quality of 3
(cherry picked from commit 147ff24a0e)

Conflicts:
	libavcodec/libvorbis.c

Fixes a part of Bug 277

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:53:51 +02:00
Justin Ruggles
5920d00d74 libvorbis: fix use of minrate/maxrate AVOptions
- enable the options for audio encoding
- properly check for user-set maxrate
- use correct calling order in vorbis_encode_setup_managed()
(cherry picked from commit 182d4f1f38)

Conflicts:
	libavcodec/libvorbis.c

Fixes a part of Bug 277

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:27:50 +02:00
Ronald S. Bultje
79fb7bc667 h264: fix deadlocks on incomplete reference frame decoding.
If decoding a second complementary field, and the first was
decoded in our thread, mark decoding of that field as complete.
If decoding fails, mark the decoded field/frame as complete.
Do not allow switching between field modes or field/frame mode
between slices within the same field/frame. Ensure that two
subsequent fields cover top/bottom (rather than top/frame,
bottom/frame or such nonsense situations).

Fixes various deadlocks when decoding samples with errors in
reference frames.

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

Fixes Bug 118

Conflicts:
	libavcodec/h264.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:00:14 +02:00
Anton Khirnov
141d4ed6c0 cmdutils: avoid setting data pointers to invalid values in alloc_buffer()
Fixes bug 352.
(cherry picked from commit 990450c5bf)

Conflicts:
	cmdutils.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:22 +02:00
Anton Khirnov
5acd1c6561 avidec: return 0, not packet size from read_packet().
(cherry picked from commit eeade678f0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:21 +02:00
Sean McGovern
a2d4d9f4fb wmapro: prevent division by zero when sample rate is unspecified
This fixes Bugzilla #327:

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 3680b24351)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:21 +02:00
Michael Niedermayer
3c55bf1201 vc1dec: check that coded slice positions and interlacing match.
This fixes out of array writes.

Addresses: CVE-2012-2796

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 1100acbab2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:35:25 +02:00
Thilo Borgmann
dc5283dffc alsdec: fix number of decoded samples in first sub-block in BGMC mode.
Fixes CVE-2012-2790

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 66197988b1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:31:21 +02:00
Mans Rullgard
c28e1c12ad alsdec: remove dead assignments
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 4ca6d206d1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:31:01 +02:00
Thilo Borgmann
c5f9c272e9 alsdec: Fix out of ltp_gain_values read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 97f0efbfb8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:27:02 +02:00
Michael Niedermayer
0f81057c12 alsdec: Check that quantized parcor coeffs are within range.
ALS spec:
	11.6.3.1.1 Quantization and encoding of parcor coefficients
	...
	In all cases the resulting quantized values ak are restricted to the range [-64,63].

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 5b051ec3bd)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:26:46 +02:00
Michael Niedermayer
592ba67815 alsdec: Check k used for rice decoder.
Values that fail this check will cause failure of decode_rice()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 23aae62c2c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:26:15 +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
Michael Niedermayer
be2dd2559f Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (23 commits)
  snow: Check mallocs at init
  vorbis: Validate that the floor 1 X values contain no duplicates.
  vorbisenc: check all allocations for failure
  indeo3: validate new frame size before resetting decoder
  lavfi: avfilter_merge_formats: handle case where inputs are same
  rv34: error out on size changes with frame threading
  rv34: Handle only complete frames in frame-mt.
  rv34: use AVERROR return values in ff_rv34_decode_frame()
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  h263: Add ff_ prefix to nonstatic symbols
  alsdec: check opt_order.
  golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
  lavf: don't segfault when a NULL filename is passed to avformat_open_input()
  mpegvideo: Don't use ff_mspel_motion() for vc1
  imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
  eval: fix swapping of lt() and lte()
  nuv: check RTjpeg header for validity
  Revert "nuv: check per-frame header for validity."
  bmpdec: only initialize palette for pal8.
  sipr: fall back to setting mode based on bit_rate.
  ...

Conflicts:
	avconv.c
	libavcodec/dnxhddec.c
	libavcodec/golomb.h
	libavcodec/h263.h
	libavcodec/imgconvert.c
	libavcodec/mpegvideo_common.h
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/rv34.c
	libavcodec/sipr.c
	libavcodec/vorbisdec.c
	libavcodec/vorbisenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-16 04:25:51 +02:00
Michael Niedermayer
2051adbfa0 cavsdec: check for changing w/h.
Our decoder does not support changing w/h.

Fixes CVE-2012-2777 and CVE-2012-2784.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit c20a696306)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
2bc1e4fcb9 indeo4: update AVCodecContext width/height on size change
Fixes CVE-2012-2787

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit b146d74730)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
0582b8e3ea avidec: use actually read size instead of requested size
Fixes CVE-2012-2788
(cherry picked from commit 0af49a63c7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
6744eee1e5 wmaprodec: check num_vec_coeffs for validity
Fixes CVE-2012-2789

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 99f392a584)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
14bba214fa lagarith: check count before writing zeros.
Fixes CVE-2012-2793

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit b631e4ed64)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
1c8e2561b4 indeo3: fix out of cell write.
Fixes CVE-2012-2776.

CC:libav-stable@libav.org

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
5c413648c1 indeo5: check tile size in decode_mb_info().
This prevents writing into a too small array if some parameters changed
without the tile being reallocated.

Fixes CVE-2012-2794

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 2d09cdbaf2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Janne Grunau
3efe6becc7 indeo5: prevent null pointer dereference on broken files
Found by John Villamil <johnv@matasano.com>
(cherry picked from commit 366ac22ea5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
dc8371b2b1 indeo5dec: Make sure we have had a valid gop header.
This prevents decoding happening on a half initialized context.

Fixes CVE-2012-2779

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 891918431d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
0815d9174c indeo4/5: check empty tile size in decode_mb_info().
This prevents writing into a too small array if some parameters changed
without the tile being reallocated.

Based on a patch by Michael Niedermayer <michaelni@gmx.at>

Fixes CVE-2012-2800

CC:libav-stable@libav.org

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
332555f660 ivi_common: make ff_ivi_process_empty_tile() static.
It's not used outside of ivi_common.c
(cherry picked from commit 5d2170c53b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Kostya Shishkov
c5ec190859 indeo: check for invalid motion vectors
(cherry picked from commit cf61aaaca1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
b561618014 indeo: clear allocated band buffers
(cherry picked from commit 23ba1503f2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
e0daa15a96 indeo: track tile macroblock size
(cherry picked from commit a6e4ac40a6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
911c250aef factor out common decoding code for Indeo 4 and Indeo 5
(cherry picked from commit aa372cf470)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
965302c9f3 indeo: check custom Huffman tables for errors
(cherry picked from commit fe7a37c36f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Anton Khirnov
0c19855539 dfa: improve boundary checks in decode_dds1()
Fixes CVE-2012-2798

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
d0267ecf76 dfa: use more meaningful return codes
(cherry picked from commit fb5c1aaea6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:20 -04:00
Kostya Shishkov
2281ac9ffd dfa: add some checks to ensure that decoder won't write past frame end
(cherry picked from commit 8099187e89)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:18 -04:00
Paul B Mahol
12941dbe2c dfa: convert to bytestream2 API
Protects from overreads.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 29b0d94b43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:33:38 -04:00
Anton Khirnov
9e575e54a0 dfa: check that the caller set width/height properly.
Fixes CVE-2012-2786.
(cherry picked from commit ee715f49a0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:31:46 -04:00
Michael Niedermayer
9a76b7375e avsdec: Set dimensions instead of relying on the demuxer.
The decode function assumes that the video will have those dimensions.

Fixes CVE-2012-2801

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 85f477935c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:29:00 -04:00
Justin Ruggles
d7de11260b ac3dec: ensure get_buffer() gets a buffer for the correct number of channels
If there is an error during frame parsing, but AVCodecContext.channels was
changed and AC3DecodeContext.out_channels was set previously, the two may not
match.

Fixes CVE-2012-2802
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:27:39 -04:00
Martin Storsjö
31bc3fb563 snow: Check mallocs at init
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 4d8516fdb1)

Conflicts:

	libavcodec/snow.c
2012-10-06 08:43:43 +02:00
Alex Converse
9aaaeba45c vorbis: Validate that the floor 1 X values contain no duplicates.
Duplicate values in this vector are explicitly banned by the Vorbis I spec
and cause divide-by-zero crashes later on.
(cherry picked from commit ecf79c4d3e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Justin Ruggles
e46cf805b1 vorbisenc: check all allocations for failure
(cherry picked from commit be8d812c96)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:43 +02:00
Kostya Shishkov
d4f3abca6a indeo3: validate new frame size before resetting decoder
(cherry picked from commit 6de226a2b8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Mina Nagy Zaki
e5f4e24942 lavfi: avfilter_merge_formats: handle case where inputs are same
This fixes a double-free crash if lists are the same due to the two
merge_ref() calls at the end of the (useless) merging that happens.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 11b6a82412)

Conflicts:

	libavfilter/formats.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Janne Grunau
b1ad5a21da rv34: error out on size changes with frame threading
Fixes CVE-2012-2772

(cherry picked from commit cb7190cd2c)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:42 +02:00
Janne Grunau
90575bd7dd rv34: Handle only complete frames in frame-mt.
Correct handling of errors to prevent hags or crashes is very complex
otherwise.

The frame initializing is also moved from decode_slice() to
decode_frame() for clarity.
(cherry picked from commit 73ad4471a4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:22 +02:00
Janne Grunau
f695bd6016 rv34: use AVERROR return values in ff_rv34_decode_frame()
Also adds an error message.
(cherry picked from commit 29330721b0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Martin Storsjö
8c0bbe5156 vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e96b4a53df)

Conflicts:
	libavcodec/4xm.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Martin Storsjö
6d1b91324c h263: Add ff_ prefix to nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit ddce8953a5)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Michael Niedermayer
a1b127515b alsdec: check opt_order.
Fixes out of array write in quant_cof.
Also make sure no invalid opt_order stays in the context.

Fixes CVE-2012-2775

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 9853e41aa0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:20:11 +02:00
Justin Ruggles
d9ffa2aca1 golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
Fixes infinite loop in FLAC decoding in case of a truncated bitstream due to
the safe bitstream reader returning 0's at the end.

Fixes Bug 310.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:07:00 +02: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 a5db8e4a1a)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:39 +02:00
Michael Niedermayer
da0c457663 mpegvideo: Don't use ff_mspel_motion() for vc1
Using ff_mspel_motion assumes that s (a MpegEncContext
poiinter) really is a Wmv2Context.

This fixes crashes in error resilience on vc1/wmv3 videos.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:18 +02:00
Janne Grunau
7a7229b52d imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
CC: libav-stable@libav.org
(cherry picked from commit 39bb27bf79)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:02 +02:00
Max Lazarov
25a1a5b1b3 eval: fix swapping of lt() and lte()
CC: libav-stable@libav.org
(cherry picked from commit caac3ab6ef)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:40 +02:00
Janne Grunau
6704522ca9 nuv: check RTjpeg header for validity
CC: libav-stable@libav.org
(cherry picked from commit 859a579e9b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:24 +02:00
Janne Grunau
fdb7080781 Revert "nuv: check per-frame header for validity."
The check is bogus since the nuv frameheader is already skipped
and the (decompressed) RTjpeg header is checked.

This reverts commit f6afacdb3b.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:11 +02:00
Anton Khirnov
bed5847563 bmpdec: only initialize palette for pal8.
Gray8 is not considered to be paletted, so this would cause an invalid
write.

Fixes bug 367.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:43 +02:00
Reimar Döffinger
e9ac06160f sipr: fall back to setting mode based on bit_rate.
Not all applications (e.g. MPlayer) set block_align, and
when using a different demuxer it might not even be
easily available.
So fall back to selecting mode based on bit rate as before
if block_align has not useful value.
It can't be worse than failing to decode completely.

(cherry picked from commit 1d0d63052b)

CC: libav-stable@libav.org
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit c54e00610f)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Kostya Shishkov
02b7239462 vc1dec: add flush function for WMV9 and VC-1 decoders
CC: libav-stable@libav.org
(cherry picked from commit 4dc8c8386e)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Reimar Döffinger
8efae4cbbf avconv: fix parsing of -force_key_frames option.
Currently it always exits with an error when more than
one position is specified.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Michael Niedermayer
50032a75d6 Changelog for 0.10.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 03:09:28 +02:00
Michael Niedermayer
eed53a38c9 Update for 0.10.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 02:34:55 +02:00
Michael Niedermayer
501e60dcf5 bmv_videodec: fix out of array read
Fixes Ticket1373

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
d36c706b86 faxcompr: fix out of array read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5891e454a6)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
fcb8bbf264 escape124: fix integer overflow leading to excessive memory allocation
Fixes Ticket1629

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
38c5e8fec5 sp5xdec: fix off by 1 error causing a crash
Fixes Ticket1633

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0896a6bd9)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
1301942248 mpegaudio_parser: reset state to prevent it to be random
Fixes Ticket1718

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Ben Jackson
e2c7b37fd2 pthread: Avoid crashes/odd behavior caused by spurious wakeups
pthread_wait_cond can wake up for no reason (Wikipedia: Spurious_wakeup).
The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or
allow the caller of avctx->execute to return before all jobs were complete.
This adds tests to both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e3329474a3)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
7f90fe1b4b Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 00:54:30 +02:00
Carl Eugen Hoyos
2cf6afffe5 Fix muxing mjpeg in swf.
(cherry picked from commit 7680d99b43)
2012-09-13 09:21:55 +02:00
jamal
50e6e494c9 build: Fix some paths in uninstall-libs
Folder and file names weren't being separated with a slash.
This resulted in .dll.a, .lib and .def files not being removed on uninstall.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
(cherry picked from commit 49440853d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 04:47:57 +02:00
Ronald S. Bultje
0f54c97f58 dxva2: include dxva.h if found
Apparently, some build environments require dxva.h even for dxva2,
while others lack this header entirely.  Including it conditionally
allows building in both cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit fa84506177)

Conflicts:

	configure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 04:45:36 +02:00
Ramiro Polla
a1f678f7ca asfenc: properly write index information
The index must take into account the pre-roll time and must seek backwards,
not forwards.

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

Conflicts:

	tests/ref/lavf/asf
	tests/ref/seek/lavf_asf

Fixes Ticket1563

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:48:59 +02:00
Ramiro Polla
94905d2af6 asfenc: remove useless casts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bc13b74992)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:37:05 +02:00
Ramiro Polla
b04fbd2cd2 asfenc: reduce code duplication with new variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2fad251b8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:36:57 +02:00
Ramiro Polla
f7b045db09 asfenc: rename some variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1ceff0859d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:36:46 +02:00
Ramiro Polla
de1591b167 asfenc: realloc index_ptr fewer times
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 97d36a1898)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:35:56 +02:00
Carl Eugen Hoyos
c7b73724c7 Clarify that -passlogfile has a different syntax when used with -vcodec libx264. 2012-08-31 14:17:01 +02:00
Anton Khirnov
1846f3b5b1 avconv: fix -force_key_frames
parse_forced_keyframes() relies in encoder timebase being set, so call
it from transcode_init() after it is known.

Conflicts:

	avconv.c

(cherry picked from commit 19ad567311)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-06-26 14:02:58 +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 8aa93e9004)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-10 11:22:57 +02:00
Mans Rullgard
e1608014c5 h264: allow cropping to AVCodecContext.width/height
Override the frame size from the SPS with AVCodecContext values
if the latter specify a size smaller by less than one macroblock.
This is required for correct cropping of MOV files from Canon cameras.

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

Conflicts:

	libavcodec/h264.c
2012-06-10 09:47:45 +02:00
Michael Niedermayer
8c0c0e9eb3 Update for 0.10.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:52:12 +02:00
Michael Niedermayer
997e7692d8 mpegvideo: fix out of heap array accesses
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 317ca0d3f7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:50:57 +02:00
Michael Niedermayer
944b6a801e mpc8: fix channel checks
fix heap array overflow

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 44c10168cf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:50:14 +02:00
Michael Niedermayer
ddd9483a10 h263: disable loop filter with lowres
Fixes ticket1212

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cc229d4e83)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:58 +02:00
Michael Niedermayer
9c13d232a4 bmv: fix apparent sign error in the frame_off check
Fixes part of Ticket1373

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:18 +02:00
Michael Niedermayer
c4926cba15 bmv: fix integer overflows in vlc decoder.
Fixes part of Ticket1373

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Based-on-patch-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 679c578cb8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:14 +02:00
Michael Niedermayer
321bbb6f49 wmv1: check that the input buffer is large enough
Fixes null ptr deref
Fixes Ticket1367

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:56 +02:00
Michael Niedermayer
81476cf693 yopdec: check frame oddness to be within supported limits
Fixes Ticket1365

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:19 +02:00
Michael Niedermayer
3c69368e6b yopdec: check that palette fits in the packet
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b6fdf8dea7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:11 +02:00
Michael Niedermayer
fcf09ebff5 8svx: fix crash
Fixes Ticket1377

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03ce421c13)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:46:55 +02:00
Michael Niedermayer
d6c73986cc dv-demux: dont mess with codec values
Fixes part of Ticket1369

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:46:03 +02:00
Paul B Mahol
aefa2bf70a binkaudio: check number of channels
Fixes #1380.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 824a6975ee)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:45:09 +02:00
Michael Niedermayer
ece27b09d6 indeo5: check quant_mat
prevents out of array read

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:45:00 +02:00
Michael Niedermayer
479856a3b2 truemotion1: Check index, fix out of array read
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fd4c1c0b70)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:44:19 +02:00
Paul B Mahol
fc0d962919 iff: check if there is extradata
Fixes #1368.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 8f61526978)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:41:15 +02:00
Michael Niedermayer
0452ebfd4b ape: Fix null ptr dereference with files missing a seekatable.
Such files are currently not supported as the table is used at several points

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:40:50 +02:00
Michael Niedermayer
9e9e6bbe7b 4xm: fix division by zero caused by bps<8
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1b8741a684)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:39:12 +02:00
Michael Niedermayer
3e4eea6c32 jvdec: check videosize
Fixes null ptr dereference
fixes Ticket1364

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:29 +02:00
Michael Niedermayer
cc0fec8393 motionpixels: check extradata size
Fixes null ptr derefernce
Fixes Ticket1363

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:22 +02:00
Michael Niedermayer
fa67ad85ac iff_ilbm: fix null ptr deref
Fixes Ticket1362

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:14 +02:00
Michael Niedermayer
0adc452146 yop: check for missing extradata
Fixes null ptr deref
Fixes Ticket1361

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:09 +02:00
Michael Niedermayer
7df0e309fd xan: fix out of array read
Fixes ticket1360

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:37:36 +02:00
Michael Niedermayer
a4b329d622 cdgraphics: Fix out of array write
Fixes Ticket1359

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1e5c7376c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:37:27 +02:00
Michael Niedermayer
eefd6bbee9 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  cmdutils: update copyright year to 2012.

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 19:17:22 +02:00
Ronald S. Bultje
ce39a84a7d cmdutils: update copyright year to 2012. 2012-06-08 12:38:58 +02:00
Michael Niedermayer
514f3e7c02 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog for the 0.8.3 Release
  Prepare for 0.8.3 Release
  ea: check chunk_size for validity.
  png: check bit depth for PAL8/Y400A pixel formats.
  qdm2: clip array indices returned by qdm2_get_vlc().
  tqi: Pass errors from the MB decoder
  h264: Add check for invalid chroma_format_idc
  h263dec: Disallow width/height changing with frame threads.

Conflicts:
	Changelog
	RELEASE
	libavcodec/eatqi.c
	libavcodec/h264_ps.c
	libavcodec/pngdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-04 13:40:13 +02:00
Reinhard Tartler
4dfea3e9f0 Update Changelog for the 0.8.3 Release 2012-06-03 19:09:07 +02:00
Reinhard Tartler
f9ee7d13e8 Prepare for 0.8.3 Release 2012-06-03 19:05:29 +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 273e6af47b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-03 19:05:29 +02:00
Ronald S. Bultje
d34e9e61dd png: check bit depth for PAL8/Y400A pixel formats.
Wrong bit depth can lead to invalid rowsize values, which crashes the
decoder further down.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-03 19:04:51 +02:00
Ronald S. Bultje
c38d3e1a39 qdm2: clip array indices returned by qdm2_get_vlc().
Prevents subsequent overreads when these numbers are used as indices
in arrays.

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

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 64953f67f9)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

Conflicts:

	libavcodec/qdm2.c
2012-06-02 19:17:53 -04:00
Michael Niedermayer
5872580e65 tqi: Pass errors from the MB decoder
This silences some valgrind warnings.
CC: libav-stable@libav.org

Fixes second half of http://ffmpeg.org/trac/ffmpeg/ticket/794
Bug found by: Oana Stratulat

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f85334f58e)
(cherry picked from commit 90290a5150)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-23 20:43:42 +02:00
Alexander Strange
4713234518 h264: Add check for invalid chroma_format_idc
Fixes a crash when FF_DEBUG_PICT_INFO is used.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 6ef4063957)

Fixes: CVE-2012-0851

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-22 21:57:38 +02:00
Michael Niedermayer
5836110018 h263dec: Disallow width/height changing with frame threads.
Fixes CVE-2011-3937

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

Conflicts:

	libavcodec/h263dec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-22 21:51:58 +02:00
Michael Niedermayer
3fab87edc9 threads: Perform the generic progress cleanup more carefully.
The cleanup is only done now when
a picture is returned (assuming that it has to be done when its returned)
a error is returned (assuming that there will be no further progress on the frame)
the codec is not h264 (this is still needed due to some deadlocks in realvideo)

This fixes a decoding regression with 00017.MTS

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 18a7f7465e)
2012-05-13 14:09:29 +02:00
Michael Niedermayer
b1f9ff45d4 update for ffmpeg 0.10.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 01:42:01 +02:00
Michael Niedermayer
96acb0a4eb indeo4: check that num_mbs matches
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d3db8988d5)
2012-05-06 01:42:01 +02:00
Michael Niedermayer
df93682e64 dsp: fix diff_bytes_mmx() with small width
Fixes Ticket1068

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 73089eccd3e48539555349b36d8aabbf1cea416e)
2012-05-06 01:42:01 +02:00
Michael Niedermayer
22285aba13 Changelog: update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 01:42:01 +02:00
Michael Niedermayer
097ad61100 mmdemux: dont set pkt->size to an invalid value.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0c97fd336e)
2012-05-06 00:59:45 +02:00
Michael Niedermayer
c785a7058a h261: check mtype.
Fixes out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec3cd74f2d)
2012-05-06 00:57:10 +02:00
Michael Niedermayer
6736de0ce6 mpegvideo: increase buffer sizes.
Fixes buffer overflow

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2c0559d5e2)
2012-05-06 00:55:36 +02:00
Michael Niedermayer
fe8508b948 mov: fix global unicode convertion array overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 437f5daf0b)
2012-05-06 00:55:06 +02:00
Michael Niedermayer
0d40fbaef0 iff: fix null ptr dereference
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 41abc9da50)
2012-05-06 00:54:40 +02:00
Michael Niedermayer
a4846943a3 xmvdemux: dont let current_stream become invalid.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 13381577d1)
2012-05-06 00:53:02 +02:00
Michael Niedermayer
bf2534a5e2 avidec: Dont crash on avi packets that belong to dv streams in dv in avi
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 096231d497)
2012-05-06 00:50:25 +02:00
Michael Niedermayer
1ca4e70b6c cook: check subacket count
Fixes out of array writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5a35bd92ad)
2012-05-06 00:47:44 +02:00
Michael Niedermayer
25a2802239 4xmdemux: Check chunk size
Fixes over reading the header array

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 00:45:04 +02:00
Michael Niedermayer
581a830829 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog for the 0.8.2 Release
  Prepare for 0.8.2 Release
  vqavideo: return error if image size is not a multiple of block size
  celp filters: Do not read earlier than the start of the 'out' vector.
  motionpixels: Clip YUV values after applying a gradient.
  jpeg: handle progressive in second field of interlaced.
  h263: more strictly forbid frame size changes with frame-mt.
  h264: additional protection against unsupported size/bitdepth changes.
  tta: prevents overflows for 32bit integers in header.
  ttadec: CRC checking
  tta: use skip_bits_long()

Conflicts:
	Changelog
	RELEASE
	libavcodec/h264.c
	libavcodec/tta.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 00:25:39 +02:00
Reinhard Tartler
43e5fda45c Update Changelog for the 0.8.2 Release 2012-05-04 22:59:01 +02:00
Reinhard Tartler
a638e10ba0 Prepare for 0.8.2 Release 2012-05-04 22:40:37 +02:00
Mans Rullgard
d5207e2af8 vqavideo: return error if image size is not a multiple of block size
The decoder assumes in various places that the image size
is a multiple of the block size, and there is no obvious
way to support odd sizes.  Bailing out early if the header
specifies a bad size avoids various errors later on.

Fixes CVE-2012-0947.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:14:26 +02:00
Alex Converse
9ea94c44b1 celp filters: Do not read earlier than the start of the 'out' vector.
CC: libav-stable@libav.org
(cherry picked from commit 37ddd38332)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Alex Converse
aaa6a66677 motionpixels: Clip YUV values after applying a gradient.
Prevents illegal reads on truncated and malformed input.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
7240cc3f8b jpeg: handle progressive in second field of interlaced.
Progressive data is allocated later in decode_sof(), not allocating
that data leads to NULL dereferences.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
7fe4c8cb76 h263: more strictly forbid frame size changes with frame-mt.
Prevents crashes because the old check was incomplete.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
746f1594d7 h264: additional protection against unsupported size/bitdepth changes.
Fixes crashes in codepaths not covered by original checks.

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

Conflicts:

	libavcodec/h264.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
0e4bb0530f tta: prevents overflows for 32bit integers in header.
This prevents sample_rate/data_length from going negative, which
caused various crashes and undefined behaviour further down.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:45 +02:00
Paul B Mahol
994c0efcc7 ttadec: CRC checking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 2af3dc8698)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:35 +02:00
Paul B Mahol
cf5e119d4a tta: use skip_bits_long()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 9aff2d1753)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:28 +02:00
Michael Niedermayer
1ee1e9e43f vqavideodev: Check image dimensions
Fixes out of heap array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3583c8706d)
Independently-Found-by: Fabian Yamaguchi
Fixes: CVE-2012-0947

Conflicts:

	libavcodec/vqavideo.c
2012-05-03 00:22:32 +02:00
Michael Niedermayer
15e9aee544 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (24 commits)
  apedec: check bits <= 32.
  truemotion: forbid invalid VLC bitsizes and token values.
  mov: don't overwrite existing indexes.
  truemotion2: handle out-of-frame motion vectors through edge extension.
  lzw: prevent buffer overreads.
  truemotion2: convert packet header reading to bytestream2.
  lagarith: fix buffer overreads.
  raw: forward avpicture_fill() error code in raw_decode().
  vc1: Do not read from array if index is invalid.
  utvideo: port header reading to bytestream2.
  bytestream: add more unchecked variants for bytestream2 API
  bytestream: K&R formatting cosmetics
  bytestream: Add bytestream2 writing API.
  aac: Reset PS parameters on header decode failure.
  mov: Do not read past the end of the ctts_data table.
  xwma: Validate channels and bits_per_coded_sample.
  asf: reset side data elements on packet copy.
  vqa: check palette chunk size before reading data.
  vqavideo: port to bytestream2 API
  wmavoice: fix stack overread.
  ...

Conflicts:
	cmdutils.c
	cmdutils.h
	libavcodec/lagarith.c
	libavcodec/truemotion2.c
	libavcodec/vqavideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-03 00:20:54 +02:00
Michael Niedermayer
e8050f313e apedec: check bits <= 32.
Fixes a floating-point exception further down.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
(cherry picked from commit 420d1df2e2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
be424d86a8 truemotion: forbid invalid VLC bitsizes and token values.
SHOW_UBITS() is only defined up to n_bits is 25, therefore forbid
values larger than this in get_vlc2() (max_bits). tokens[][] can be
used as an index in deltas[], which has a size of 64, so ensure the
values are smaller than that.

This prevents crashes on corrupt bitstreams.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +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 4f7c7624c0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
46f8bbfc6d truemotion2: handle out-of-frame motion vectors through edge extension.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bf39d3b59d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
562c6a7bf1 lzw: prevent buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ddcf67c8a5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
e711ccee4d truemotion2: convert packet header reading to bytestream2.
Also use correct buffer sizes in calls to tm2_read_stream(). Together,
this prevents overreads.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
d6372e80fe lagarith: fix buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 0a82f5275f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
29d91e9161 raw: forward avpicture_fill() error code in raw_decode().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 98df2e2414)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Mashiat Sarker Shakkhar
583f57f04a vc1: Do not read from array if index is invalid.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 95b192de5d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
f8f6c14f54 utvideo: port header reading to bytestream2.
Fixes crash during slice size reading if slice_end goes negative.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Paul B Mahol
9e24f2a1f0 bytestream: add more unchecked variants for bytestream2 API
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit f1ce053cd0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Aneesh Dogra
e788c6e9cb bytestream: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit ab9ae40152)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Aneesh Dogra
2e681cf50f bytestream: Add bytestream2 writing API.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit db7d45237a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Alex Converse
9ddd3abe78 aac: Reset PS parameters on header decode failure.
If the next header frame codes zero envelopes the previous frame's
values will be used. Consequently the invalid values must be cleared.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +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 86f2ae06b9)

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 5023b89bba)

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 e73c6aaabf)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
c21b858b27 vqa: check palette chunk size before reading data.
Prevents overreads beyond buffer boundaries.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Paul B Mahol
0b9bb581fd vqavideo: port to bytestream2 API
Protects against overreads.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 5a3a906ba2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
105601c151 wmavoice: fix stack overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 262196445c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
3a4949aa50 indeo4: fix out-of-bounds function call.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 68fd077f68)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Reinhard Tartler
ec554ee747 Read preset files with suffix .avpreset
The preset files have been renamed some time ago.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
bf3998d71e mimic: don't use self as reference, and report completion at end of decode().
Fixes hangs on corrupt samples that reference self-frames.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
87208b8fc4 mpeg4: report frame decoding completion at ff_MPV_frame_end().
Prevents hangs on corrupt input.

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

Conflicts:

	libavcodec/mpegvideo.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
265a628f16 h264: use struct offsets in get_cabac_bypass_sign_x86().
(cherry picked from commit db025929f2)
2012-04-21 21:41:30 +02:00
ami_stuff
a854d00acd Replace SSE2 instruction in scalarproduct_float_sse() by SSE equivalent.
Fixes an AAC decoding issue with the sample from ticket #213 on machines
with SSE but without SSE2.
Based on 89411a by Reimar.

(cherry picked from commit f6b7863808)
2012-04-04 09:16:49 +02:00
Stefano Sabatini
d076d0febd lavfi/fade: fix black level for non studio-level pixel formats
Fix trac ticket #1139, regression introduced in 8c1fb50d07.
(cherry picked from commit 95ce0ddcfe)
2012-04-04 09:04:15 +02:00
Michael Niedermayer
a56eaa024f mpeg4: dont reset picture_num for xvid
Fixes Ticket1162

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a4e359a3f9)
2012-04-04 08:38:18 +02:00
Michael Niedermayer
fdc6f6507c h264: fix seeking in low delay streams without IDR
Fixes Ticket1165

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3360b8517a)
2012-04-04 08:38:06 +02:00
Michael Niedermayer
976d173606 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  id3v2: fix skipping extended header in id3v2.4

Conflicts:
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-02 00:52:23 +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 ddb4431208)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-01 19:30:21 +02:00
Franz Brauße
f9bdc93723 smacker audio: sign-extend the initial 16-bit predicted value
Fixes Bug #265

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 12cbbbb4ab)
2012-04-01 13:57:49 +02:00
Tomas Härdin
e687d77d15 mxfdec: Only parse next partition pack if parsing forward
This fixes ticket #1099.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 393b81f093)
2012-03-21 13:25:59 +01:00
Michael Niedermayer
abfafb6c81 pngenc: Fix incorrect mask used for interlaced mode.
Fixes Ticket1109

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 15db6a9590)
2012-03-21 10:50:58 +01:00
Michael Niedermayer
f139838d64 Update for 0.10.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 09:14:13 +01:00
Kelly Anderson
0a224ab102 libx264: fix duplicate stats entry
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 08:56:59 +01:00
Michael Niedermayer
d39b183d8d Update for 0.10.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 01:41:41 +01:00
Stefano Sabatini
dc8054128a lavfi: port MP swapuv filter
(cherry picked from commit fa35d880aa)

Conflicts:

	Changelog
	libavfilter/version.h

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 00:36:18 +01:00
Michael Niedermayer
001f4c7dc6 jpeglsdec: Prevent out of array write.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 00ab9cdae1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:46:30 +01:00
Michael Niedermayer
313ddbfe48 proresdec: Fix read via negative index in a global array.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0065080320)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:42:49 +01:00
Michael Niedermayer
7f5bd6c72b diracdec: Correct the bytestream end pointer.
This fixes some arith decoder overreads and a potential infinite loop.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:00:07 +01:00
Michael Niedermayer
0be85fd80f diracdec: Check for negative quants which would cause out of array reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5cd8afee99)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:59:30 +01:00
Michael Niedermayer
9f253ebb41 diracdec: Fix integer overflow leading to out of global array read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9729f140ae)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:59:21 +01:00
Michael Niedermayer
6242dae507 sonic: update to new API
Fixes Ticket1075

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:23:10 +01:00
Michael Niedermayer
1749b0d74d mmvideo: restore initial y value.
This bug might have been exploitable (out of HEAP buffer writes)

Bug introduced by libav
	commit a55d5bdc6e
	Date:   Tue Mar 6 15:15:42 2012 -0800

	    algmm: convert to bytestream2 API.
(cherry picked from commit c2e3b564b3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 14:46:08 +01:00
Michael Niedermayer
568e9062bd Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (154 commits)
  Update Changelog for the 0.8.1 Release
  dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2
  dca: don't use av_clip_uintp2().
  snow: check reference frame indices.
  snow: reject unsupported chroma shifts.
  xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
  h264: increase reference poc list from 16 to 32.
  h264: stricter reference limit enforcement.
  h264: improve parsing of broken AVC SPS
  Replace computations of remaining bits with calls to get_bits_left().
  png: convert to bytestream2 API.
  roqvideo: convert to bytestream2 API.
  smc: port to bytestream2 API.
  tgq: convert to bytestream2 API.
  algmm: convert to bytestream2 API.
  jvdec: unbreak video decoding
  h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
  libx264: add 'stats' private option for setting 2pass stats filename.
  libx264: fix help text for slice-max-size option.
  avconv: reindent
  ...

Conflicts:
	Changelog
	RELEASE
	avconv.c
	doc/APIchanges
	ffplay.c
	libavcodec/Makefile
	libavcodec/aacdec.c
	libavcodec/alsdec.c
	libavcodec/atrac3.c
	libavcodec/avcodec.h
	libavcodec/dvdata.c
	libavcodec/fraps.c
	libavcodec/golomb.h
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_direct.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264idct_template.c
	libavcodec/indeo3.c
	libavcodec/kgv1dec.c
	libavcodec/kmvc.c
	libavcodec/mjpegbdec.c
	libavcodec/mmvideo.c
	libavcodec/mpegaudiodec.c
	libavcodec/mpegvideo.h
	libavcodec/options.c
	libavcodec/pngdec.c
	libavcodec/roqvideodec.c
	libavcodec/shorten.c
	libavcodec/svq3.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/wmadec.c
	libavcodec/xxan.c
	libavformat/Makefile
	libavformat/asfdec.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/nsvdec.c
	libavformat/utils.c
	libavformat/version.h
	libavutil/avutil.h
	libavutil/error.c
	libavutil/error.h
	libswscale/swscale.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/ref/acodec/g722

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 09:01:08 +01:00
Michael Niedermayer
5dbc75870f qpeg: Fix out of array writes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Fabian Greffrath
c91a14638e srtdec: fix a format string vulnerability.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit aaa1173de7)
2012-03-16 06:29:10 +01:00
Nathan Caldwell
c00c380724 aacenc: Fix LONG_START windowing.
Forgot to add the equivalent amount to the incoming sample pointer as the output pointer.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 2e626dd513)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Nathan Caldwell
43625c5128 aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
10l: Forgot to adjust deinterleave for new location of incoming samples in 7946a5a.

This produced incorrect, but surprisingly listenable results.

Thanks to Justin Ruggles for the report.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit dc7e7d4dd9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Reinhard Tartler
5effcfa767 Update Changelog for the 0.8.1 Release 2012-03-15 08:58:14 +01:00
Kostya Shishkov
1ee0cd1ad7 dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-03-14 23:32:15 +01:00
Ronald S. Bultje
b594732475 dca: don't use av_clip_uintp2().
The argument is not a literal, thus causing the ARM v6 or later
builds to break.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-03-14 23:30:19 +01:00
Michael Niedermayer
ce15406e78 snow: check reference frame indices.
Fixes NULL ptr dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1f8ff2b13c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:35:09 +01:00
Michael Niedermayer
c9e95636a8 snow: reject unsupported chroma shifts.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit c9837954e7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:55 +01:00
Ronald S. Bultje
6e5c07f4c8 xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 86020073db)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:36 +01:00
Ronald S. Bultje
c999a8ed65 h264: increase reference poc list from 16 to 32.
Interlaced images can have 32 references (16 per field), so limiting the
array size to 16 leads to invalid writes.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:13 +01:00
Ronald S. Bultje
4d343a6f47 h264: stricter reference limit enforcement.
Progressive images can have only 16 references, error out if there are
more, since the data is almost certainly corrupt, and the invalid value
will lead to random crashes or invalid writes later on.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:33:15 +01:00
Michael Niedermayer
a81a6d9c80 h264: improve parsing of broken AVC SPS
Parsing the entire NAL as SPS fixes decoding of some AVC bitstreams
with broken escaping. Since the size of the NAL unit is known and
checked against the buffer end we can parse it entirely without buffer
overreads.

Fixes playback of
http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 3aa661ec56)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:27:22 +01:00
Alex Converse
48f0eeb2e5 Replace computations of remaining bits with calls to get_bits_left().
(cherry picked from commit 3574a85ce5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:27:16 +01:00
Ronald S. Bultje
d26e47bf6c png: convert to bytestream2 API.
Protects against overreads in the input buffer.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:14:28 +01:00
Ronald S. Bultje
568a474a08 roqvideo: convert to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cdf1577162)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:40 +01:00
Ronald S. Bultje
9a66cdbc16 smc: port to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8febcb9fc1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:28 +01:00
Ronald S. Bultje
ddb1149e25 tgq: convert to bytestream2 API.
This protects against input buffer overreads.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:19 +01:00
Ronald S. Bultje
f6778f58d4 algmm: convert to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a55d5bdc6e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:19 +01:00
Paul B Mahol
e4e4d92641 jvdec: unbreak video decoding
The safe bitstream reader broke it since the buffer size was specified
in bytes instead of bits.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
CC: libav-stable@libav.org
(cherry picked from commit a1c036e961)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:02:23 +01:00
Michael Niedermayer
de0ff4ce69 h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 758ec11153)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:52 +01:00
Anton Khirnov
6548cb2578 libx264: add 'stats' private option for setting 2pass stats filename.
x264 always opens the file itself with fopen, so we cannot use the
standard lavc stats mechanism.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:12 +01:00
Anton Khirnov
f6257cf4b7 libx264: fix help text for slice-max-size option.
CC: libav-stable@libav.org
(cherry picked from commit 9d5c131ece)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:02 +01:00
Anton Khirnov
a15adb18fa avconv: reindent
CC: libav-stable@libav.org
(cherry picked from commit 64334ddbbc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:59:00 +01:00
Anton Khirnov
666bd5848a avconv: link '-passlogfile' option to libx264 'stats' AVOption.
Fixes bug 204.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:57:11 +01:00
Janne Grunau
d94256d36c Revert "h264: clear trailing bits in partially parsed NAL units"
This reverts commit 729ebb2f18.

There was an off-by-one error in the bit mask calculation clearing
actually the last valid bit and causing
http://bugzilla.libav.org/show_bug.cgi?id=227

The broken sample (Mr_MrsSmith-h264_aac.mp4) the commit was fixing
does not work after correcting the off-by-one error.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:56:55 +01:00
Ronald S. Bultje
7bb97a61df mpc: pad mpc_CC/SCF[] tables to allow for negative indices.
MPC8 allows indices of mpc_CC up to -1, and mpc_SCF up to -6, thus pad
the tables by that much on the left end.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:48:29 +01:00
Ronald S. Bultje
c65eadee5d xxan: protect against chroma LUT overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f77bfa8376)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
a43f4bd601 xxan: convert to bytestream2 API.
Protects against overreads.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
8f881885c2 xxan: don't read before start of buffer in av_memcpy_backptr().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f1279e286b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
26521d87ba dsicinvideo: validate buffer offset before copying pixels.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c95fefa042)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
e1a4143793 cook: error out on quant_index values outside [-63, 63] range.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 97e48b2f54)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
b9482a6efd cook: extend channel uncoupling tables so the full bit range is covered.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 37cc8600d0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
88c3cc019c cook: expand dither_tab[], and make sure indexes into it don't overflow.
Fixes overflows in accessing dither_tab[].

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:40:29 +01:00
Ronald S. Bultje
9980e4df3b huffyuv: add padding to classic (v1) huffman tables.
We slightly overread the input buffer, so we require
padding at the end of the buffer, as is documented in the
get_bits API. Without padding, we'll read uninitialized
data or beyond the end of the .rodata, which may crash.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:36:39 +01:00
Ronald S. Bultje
d4f2786cda avs: fix infinite loop on end-of-stream.
The codec would keep returning the last decoded frame if the stream
contains B-frames, since it wouldn't clear that frame from the list of
frames to be returned to the user.

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

Conflicts:

	libavcodec/cavsdec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:36:02 +01:00
Alex Converse
2744fdbd9e tiffdec: Prevent illegal memory access caused by recycled pointers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd0be63049)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:55 +01:00
Ronald S. Bultje
1fcc2c6091 wma: fix off-by-one in array bounds check.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b4bccf3e4e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:39 +01:00
Ronald S. Bultje
74871ac70a dv: check buffer size before reading profile.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e97efecec8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:21 +01:00
Ronald S. Bultje
9cb7f6e54a raw: move buffer size check up.
This way, it protects against overreads for 4bpp/2bpp content also.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:23:58 +01:00
Ronald S. Bultje
ed6aaf579d dca: prevent accessing static arrays with invalid indexes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e6ffd997cb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:22:32 +01:00
Ronald S. Bultje
e1b4614ab4 lpcm: fix sample size calculation for 20bit LCPM.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f1320dc3be)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:12:00 +01: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 a93b572ae4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:12:00 +01:00
Ronald S. Bultje
12247a13e0 Don't use ff_cropTbl[] for IDCT.
Results of IDCT can by far outreach the range of ff_cropTbl[], leading
to overreads and potentially crashes.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
7503861b42 swscale: make filterPos 32bit.
Fixes overflows for large image sizes.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
9def2f200e error_resilience: initialize s->block_index[].
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6193ff6854)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
7b676935ee svq3: protect against negative quantizers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 11b940a1a8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Reinhard Tartler
9550c63196 Prepare for 0.8.1 Release 2012-03-08 22:07:54 +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 3798205a77)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:54 +01:00
Janne Grunau
a47b96bdd3 rv34: handle size changes during frame multithreading
Factors all context dynamic memory handling to its own functions.
Fixes bug 220.
(cherry picked from commit 2bd730010d)

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 b142496c56)
2012-03-06 15:31:49 -08:00
Alex Converse
4a325ddeae mov: Add support for MPEG2 HDV 720p24 (hdv4)
(cherry picked from commit 0ad522afb3)
2012-03-06 15:31:41 -08:00
Alex Converse
48ac765efe rv10/20: Fix slice overflow with checked bitstream reader.
(cherry picked from commit 9243ec4a50)
2012-03-06 15:31:23 -08:00
Michael Niedermayer
522645e38f h263dec: Disallow width/height changing with frame threads.
Fixes CVE-2011-3937

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

Conflicts:

	libavcodec/h263dec.c

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:28:01 -08:00
Alex Converse
e891ee4bf6 adpcm: Clip step_index values read from the bitstream at the beginning of each frame.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit bbeb29133b)
2012-03-06 15:28:01 -08:00
Alex Converse
ef673211e7 tiff: Make the TIFF_LONG and TIFF_SHORT types unsigned.
TIFF v6.0 (unimplemented) adds signed equivalents.
(cherry picked from commit e32548d133)
2012-03-06 15:28:01 -08:00
Alex Converse
eaeaeb265f dpcm: ignore extra unpaired bytes in stereo streams.
Fixes: CVE-2011-3951

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit ce7aee9b73)
2012-03-06 15:28:01 -08:00
Alex Converse
db315c796d svq3: Prevent illegal reads while parsing extradata.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 9e1db721c4)
2012-03-06 15:28:01 -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 0ab3687924)
2012-03-06 15:28:01 -08:00
Michael Niedermayer
e3743869e9 ac3dec: Move center and surround mix level tables to the parser.
That way all mix levels as exported by avpriv_ac3_parse_header()
will have the same meaning.

Previously the 3-bit center mix level for E-AC-3 was used to index in a
4-entry table, leading to out-of-array reads.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit e6d9fa66f1)
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 29a20ac4a1)
2012-03-06 15:28:01 -08:00
Mans Rullgard
627f4621f5 ac3: Do not read past the end of ff_ac3_band_start_tab.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 034b03e7a0)
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 2d1c0dea5f)
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 5a396bb3a6)
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 635bcfccd4)
2012-03-06 15:28:00 -08:00
Dale Curtis
feed0c6b6a mpegaudiodec: Prevent premature clipping of mp3 input buffer.
Instead of clipping extrasize based on EXTRABYTES, clip based on the
amount of buffer actually left. Without this fix, there are warbles
and other distortions in the test case below.

http://kevincennis.com/mix/assets/sounds/1901_voxfx.mp3
(cherry picked from commit b716542691)

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:28:00 -08:00
Alex Converse
d0e53ecff7 mp3dec: Fix a heap-buffer-overflow
In some cases, what is left to read from ptr is smaller than EXTRABYTES.

Based on a patch by Thierry Foucu <tfoucu@gmail.com>.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit f372ce119b)
2012-03-06 15:28:00 -08:00
Alex Converse
1ca84aa162 mpeg12: Pad framerate tab to 16 entries.
There are many places where we read an unchecked 4-bit index into it.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit dfa37fe8a3)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
d5f2382d03 kgv1dec: Increase offsets array size so it is large enough.
Fixes CVE-2011-3945

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

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit a02e8df973)
2012-03-06 15:28:00 -08:00
Alex Converse
416849f2e0 kmvc: Check palsize.
Fixes: CVE-2011-3952

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Based on fix by Michael Niedermayer
(cherry picked from commit 386741f887)
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 c898431ca5)

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 8fd8a48263)
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 5c011706bc)

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 6a89b41d97)
2012-03-06 15:28:00 -08:00
Martin Storsjö
ca7e97bdcf g722: Fix the QMF scaling
This fixes clipping if the encoder input used the full 16 bit
input range (samples with a magnitude below 16383 worked fine).
The filtered subband samples should be 15 bit maximum, while
the code earlier produced them scaled to 16 bit.

This makes the decoder output have double the magnitude
compared to before.

The spec reference samples doesn't test the QMF at all, which
was why this part slipped past initially.

(cherry picked from commit b087ce2bee)

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-06 15:45:30 +02:00
Justin Ruggles
4ae138cb12 ac3dsp: do not use pshufb in ac3_extract_exponents_ssse3()
We need to do unsigned saturation in order to cover the corner case when the
absolute coefficient value is 16777215 (the maximum value).

Fixes Bug #216
(cherry picked from commit d483bb58c3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-06 13:55:35 +01:00
Fabian Greffrath
003f7e3dd0 Fix format string vulnerability detected by -Wformat-security.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit c9dbac36ad)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:01:37 +01:00
Ronald S. Bultje
85eb76a23f h264: fix mmxext chroma deblock to use correct TC values.
(cherry picked from commit b0c4f04338)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:00:43 +01:00
Ronald S. Bultje
5186984ee9 h264: change underread for 10bit QPEL to overread.
This prevents us from reading before the start of the buffer, and thus
prevents crashes resulting from this behaviour. Fixes bug 237.
(cherry picked from commit 291c9b6285)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:00:31 +01:00
Ronald S. Bultje
b5331b979b cscd: use negative error values to indicate decode_init() failures.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8a9faf33f2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Vitor Sessak
11f3173e1b amrnbdec: check frame size before decoding.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 882abda5a2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Ronald S. Bultje
cd17195d1c h264: prevent overreads in intra PCM decoding.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d1604b3de9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Justin Ruggles
1128b10247 wmaenc: fix m/s stereo encoding for the first frame
We need to set ms_stereo in encode_init() in order to avoid incorrectly
encoding the first frame as non-m/s while flagging it as m/s. Fixes an
uncomfortable pop in the left channel at the start of playback.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
6a073aa7a7 wmaenc: limit allowed sample rate to 48kHz
ff_wma_init() allows up to 50kHz, but this generates an exponent band
size table that requires 65 bands. The code assumes 25 bands in many
places, and using sample rates higher than 48kHz will lead to buffer
overwrites.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
073891e875 wmaenc: limit block_align to MAX_CODED_SUPERFRAME_SIZE
This is near the theoretical limit for wma frame size and is the most that
our decoder can handle. Allowing higher bit rates will just end up padding
each frame with empty bytes.

Fixes invalid writes for avconv when using very high bit rates.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
2e341bc99a wmaenc: require a large enough output buffer to prevent overwrites
The maximum theoretical frame size is around 17000 bytes. Although in
practice it will generally be much smaller, we require a larger buffer
just to be safe.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01: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 4df369692e)

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 1aa708988a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
78d4f8cc56 amrwb: remove duplicate arguments from extrapolate_isf().
Prevents warnings because the dst and src overlap (are the same) in the
memcpy() inside the function.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
de2656ec25 amrwb: error out early if mode is invalid.
Prevents using the invalid mode as an index in a static array, which
would generate invalid reads.

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

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 9c239f6026)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
b863979c0f wma: fix invalid buffer size assumptions causing random overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 349b7977e4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Alex Converse
fecd7468fc wmadec: Verify bitstream size makes sense before calling init_get_bits.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 48f1e5212c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Alex Converse
19da1a39e8 rv10/20: Fix a buffer overread caused by losing track of the remaining buffer size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2f6528537f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
7e88df99e1 lcl: return negative error codes on decode_init() errors.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bd17a40a7e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Justin Ruggles
7f3f85544c avutil: add AVERROR_UNKNOWN
Useful to return instead of -1 when the cause of the error is unknown,
typically from an external library.
(cherry picked from commit c9bca80132)

Conflicts:

	doc/APIchanges
	libavutil/avutil.h

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
750f5baf30 h264: error out on invalid bitdepth.
Fixes invalid reads while initializing the dequant tables, which uses
the bit depth to determine the QP table size.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
a63f3f714c huffyuv: do not abort on unknown pix_fmt; instead, return an error.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 63c9de6469)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
1dd1ee00d5 vmnc: return error on decode_init() failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 07a180972f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
4493af756b rpza: error out on buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 78e9852a2e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
e904e9b720 qtrle: return error on decode_init() failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e54ae60e46)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
5f896773e0 swscale: fix another integer overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 791de61bbb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
b2dcac7141 vp56: error out on invalid stream dimensions.
Prevents crashes when playing corrupt vp5/6 streams.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:23:11 +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 bb6d5411e1)

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 6e57a02b9f)

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 dd6d3b0e02)

Conflicts:

	doc/APIchanges

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-29 10:44:37 +01:00
Paul B Mahol
a1556d37b8 avutil: make intfloat api public
The functions are already av_ prefixed and intfloat header is already provided.
Install libavutil/intfloat.h

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8b933129b9)

Conflicts:

	doc/APIchanges

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-29 10:44:37 +01:00
Alex Converse
083a8a0037 mjpegbdec: Fix overflow in SOS.
Based in part by a fix from Michael Niedermayer <michaelni@gmx.at>

Fixes CVE-2011-3947

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 22:20:45 +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 934cd18a43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 22:10:55 +01:00
Ronald S. Bultje
9dbd437da2 Indeo3: fix crashes on corrupt bitstreams.
Splits at borders of cells are invalid, since it leaves one of the
cells with a width/height of zero. Also, propagate errors on buffer
allocation failures, so we don't continue decoding (which crashes).

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 20:57:44 +01:00
Ronald S. Bultje
2510e1476e vorbis: fix overflows in floor1[] vector and inverse db table index.
(cherry picked from commit 24947d4988)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 18:11:15 +01:00
Reinhard Tartler
0f839cff6b Fix parser not to clobber has_b_frames when extradata is set.
Because in contrast to the decoder, the parser does not setup low_delay.
The code in parse_nal_units would always end up setting has_b_frames
to "1", except when stream is explicitly marked as low delay.
Since the parser itself would create 'extradata', simply reopening
the parser would cause this.

This happens for instance in estimate_timings_from_pts(), which causes the
parser to be reopened on the same stream.

This fixes Libav #22 and FFmpeg (trac) #360

CC: libav-stable@libav.org

Based on a patch by Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(commit 31ac0ac29b)

Comments and description adapted by Reinhard Tartler.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 790a367d9e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 15:56: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 aac07a7a4c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:04:04 +01:00
Ronald S. Bultje
0d30e2c6f2 fraps: release reference buffer on pix_fmt change.
Prevents crash when trying to copy from a non-existing plane in e.g.
a RGB32 reference image to a YUV420P target image

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
a0473085f3 kgv1: release reference picture on size change.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6c4c27adb6)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
e537dc230b kgv1: use avctx->get/release_buffer().
Also fixes crashes on corrupt bitstreams.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
19f4943d12 lcl: error out if uncompressed input buffer is smaller than framesize.
This prevents crashes when trying to read beyond the end of the buffer
while decoding frame data.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
bf6d1a1ca7 mjpeg: abort decoding if packet is too large.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ab492ca2ab)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Alex Converse
424b6edd19 tiff: Prevent overreads in the type_sizes array.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 447363870f)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +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 31632e73f4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
8e3dc37bc0 truemotion2: error out if the huffman tree has no nodes.
This prevents crashers and errors further down when reading nodes in the
empty tree.

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

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 e30b3e59a4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Janne Grunau
62beae313a avplay: fix -threads option
The AVOptions based default to threads auto in 2473a45c8
works only if avplay does not use custom option handling
for -threads.

CC: <libav-stable@libav.org>
(cherry picked from commit e48a70e6da)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
8011a29fa8 vc1parse: call vc1_init_common().
The parser uses VLC tables initialized in vc1_common_init(), therefore
we should call this function on parser init also.

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

Conflicts:

	libavcodec/vc1.h

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
fe710f2074 wma: don't return 0 on invalid packets.
Return 0 means "please return the same data again", i.e. it causes an
infinite loop. Instead, return an error.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
bba43a1ea0 mjpegb: don't return 0 at the end of frame decoding.
Return 0 indicates "please return the same data again", i.e. it causes
an infinite loop. Instead, return that we consumed the buffer if we
finished decoding succesfully, or return an error if an error occurred.

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

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 41afac7f7a)

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 32a659c758)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
95a9d44dc3 mp3on4: require a minimum framesize.
If bufsize < headersize, init_get_bits() will be called with a negative
number, causing it to fail and any subsequent call to get_bits() will
crash because it reads from a NULL pointer.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
27558bd87e huffyuv: error out on bit overrun.
On EOF, get_bits() will continuously return 0, causing an infinite
loop.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
5ab9294a8d als: prevent infinite loop in zero_remaining().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit af468015d9)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
cfd7d166e2 cook: prevent div-by-zero if channels is zero.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 941fc1ea1e)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
5bcd47cf63 vc1: prevent using last_frame as a reference for I/P first frame.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ae591aeea5)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
0c60d5c59f swscale: take first/lastline over/underflows into account for MMX.
Fixes crashes for extremely large resizes (several 100-fold).

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
cd9bdc6395 swscale: fix overflows in filterPos[] calculation for large sizes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 19a65b5be4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
b68470707b swscale: enforce a minimum filtersize.
At very small dimensions, this calculation could lead to zero-sized
filters, which leads to uninitialized output, zero-sized allocations,
loop overflows in SIMD that uses do{..}while(i++<filtersize); instead
of for(i=0;i<filtersize;i++){..} and several other similar failures.
Therefore, require a minimum filtersize of 1.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
7046ae5593 tta: error out if samplerate is zero.
Prevents a division by zero later on.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
d19e3e19d6 vc1: prevent null pointer dereference on broken files
CC: libav-stable@libav.org
(cherry picked from commit 510ef04a46)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
04597e2595 smacker: Sanity check huffman tables found in the headers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

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 b3461c29c1)

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 cd40c31ee9)

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 d2ee8c1779)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
683213230e aac: fix infinite loop on end-of-frame with sequence of 1-bits.
Based-on-work-by: Ronald S. Bultje <rsbultje@gmail.com>
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1cd9a6154b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
ad0ee682b3 wma: Clip WMA1 and WMA2 frame length to 11 bits.
The MDCT buffers in the decoder are only sized for up to 11 bits. The
reverse engineered documentation for WMA1/2 headers say that that for
all samplerates above 32kHz 11 bits are used. 12 and 13 bit support
were added for WMAPro. I was unable to make any Microsoft tools generate
a test file at a samplerate above 48kHz.

Discovered by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
ba418ad400 rv20: prevent calling ff_h263_decode_mba() with unset height/width
Prevents a crash of VLC during playback of a invalid matroska file,
found by John Villamil <johnv@matasano.com>.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
6dcbbdc011 flac: fix infinite loops on all-zero input or end-of-stream.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 52e4018be4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
e43bd4fa58 golomb: use HAVE_BITS_REMAINING() macro to prevent infloop on EOF.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 46b3fbc30b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
25b4ed053f get_bits: add HAVE_BITS_REMAINING macro.
(cherry picked from commit b44b41633f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
e1f2a6a32b golomb: avoid infinite loop on all-zero input (or end of buffer).
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c6643fddba)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
6fc3287b9c shorten: Use separate pointers for the allocated memory for decoded samples.
Fixes invalid free() if any of the buffers are not allocated due to either
not decoding a header or an error prior to allocating all buffers.

Fixes CVE-2012-0858
CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 204cb29b3c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
f43b6e2b1e atrac3: Fix crash in tonal component decoding.
Add a check to avoid writing past the end of the channel_unit.components[]
array.

Bug Found by: cosminamironesei
Fixes CVE-2012-0853
CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit c509f4f747)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
697a45d861 ws_snd1: Fix wrong samples count and crash.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9fb7a5af97)

Addresses CVE-2012-0848

Reviewed-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:05 +01:00
Ronald S. Bultje
4c7879775e h264: disallow constrained intra prediction modes for luma.
Conversion of the luma intra prediction mode to one of the constrained
("alzheimer") ones can happen by crafting special bitstreams, causing
a crash because we'll call a NULL function pointer for 16x16 block intra
prediction, since constrained intra prediction functions are only
implemented for chroma (8x8 blocks).

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:27 +01:00
Ronald S. Bultje
a2c8db1b79 swscale: fix V plane memory location in bilinear/unscaled RGB/YUYV case.
Fixes bug 221.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Martin Storsjö
fc89f15497 libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
Earlier, calling avcodec_encode_audio worked fine even if time_base
wasn't set. Now it crashes due to trying to scale the output pts to
the codec context time base. This affects e.g. VLC.

If no time_base is set for audio codecs, set it to the sample
rate.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Alex Converse
e364f50718 qdm2: Check data block size for bytes to bits overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +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 bc90199848)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Anton Khirnov
bafd38a352 lavc: make avcodec_close() work properly on unopened codecs.
I.e. free the priv_data and other stuff allocated in
avcodec_alloc_context3() and not segfault.

(cherry picked from commit 0e72ad95f9)
2012-02-26 09:09:26 +01:00
Anton Khirnov
350d06d63f lavc: add avcodec_is_open().
It allows to check whether an AVCodecContext is open in a documented
way. Right now the undocumented way this check is done in lavf/lavc is
by checking whether AVCodecContext.codec is NULL. However it's desirable
to be able to set AVCodecContext.codec before avcodec_open2().

(cherry picked from commit af08d9aeea)

Conflicts:

	doc/APIchanges
2012-02-26 09:03:33 +01:00
Derek Buitenhuis
9f82cbf7c1 wavpack: Don't shift minclip/maxclip
Since we are clipping before we shift the values to
16 or 32 bits, we should not shift the min/max clip
values to compensate.

Fixes 8 and 24 bit lossy decoding.

Fixes ticket #871.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 480b133e6f)
2012-02-25 20:50:27 +01:00
Michael Niedermayer
dcde8e1c90 Revert "Improve decoding quality for lossy wavpack."
This has been implemented more correctly.

This reverts commit a915618a29.
(cherry picked from commit 32e74395a8)
2012-02-25 20:50:19 +01:00
Carl Eugen Hoyos
569cb94869 Fix ffmpeg -codecs output.
(cherry picked from commit f6492476a6)
2012-02-18 00:00:06 +01:00
Justin Ruggles
0df7d7482c wavpack: add needed braces for 2 statements inside an if block
(cherry picked from commit 9d7cee50aa)
2012-02-12 01:48:07 +01:00
Carl Eugen Hoyos
b2f27d2926 Improve decoding quality for lossy wavpack.
This reverts e6e7bfc1 and 365e1ec2.
The code may be incorrect both before and after the revert, but we
do not have any samples that were fixed by the original commits.

Fixes ticket #871.
(cherry picked from commit a915618a29)
2012-01-29 18:02:12 +01:00
Michael Niedermayer
7e16636995 doc: remove doc/ffmpeg-mt-authorship.txt for release/0.10
we dont carry the whole git history in releases so theres no
point in having this in them either.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-26 22:44:59 +01:00
Michael Niedermayer
83d78fece0 Update for 0.10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-26 22:43:32 +01:00
456 changed files with 9069 additions and 10179 deletions

293
Changelog
View File

@@ -3,6 +3,299 @@ releases are sorted from youngest to oldest.
version next:
version 0.10.11
- pthread: Avoid spurious wakeups
- pthread: Fix deadlock during thread initialization
- mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
- vc1dec: Don't decode slices when the latest slice header failed to decode
- vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
- r3d: Add more input value validation
- fraps: Make the input buffer size checks more strict
- svq3: Avoid a division by zero
- rmdec: Validate the fps value
- twinvqdec: Check the ibps parameter separately
- asfdec: Check the return value of asf_read_stream_properties
- mxfdec: set audio timebase to 1/samplerate
- pcx: Check the packet size before assuming it fits a palette
- rpza: Fix a buffer size check
- xxan: Disallow odd width
- xan: Only read within the data that actually was initialized
- xan: Use bytestream2 to limit reading to within the buffer
- pcx: Consume the whole packet if giving up due to missing palette
- pngdec: Stop trying to decode once inflate returns Z_STREAM_END
- mov: Make sure the read sample count is nonnegative
- bfi: Add some very basic sanity checks for input packet sizes
- bfi: Avoid divisions by zero
- electronicarts: Add more sanity checking for the number of channels
- riffdec: Add sanity checks for the sample rate
- mvi: Add sanity checking for the audio frame size
- xwma: Avoid division by zero
- avidec: Make sure a packet is large enough before reading its data
- vqf: Make sure the bitrate is in the valid range
- vqf: Make sure sample_rate is set to a valid value
- vc1dec: Undo mpegvideo initialization if unable to allocate tables
- vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
- wnv1: Make sure the input packet is large enough
- dca: Validate the lfe parameter
- rl2: Avoid a division by zero
- wtv: Add more sanity checks for a length read from the file
- segafilm: Validate the number of audio channels
- qpeg: Add checks for running out of rows in qpeg_decode_inter
- mpegaudiodec: Validate that the number of channels fits at the given offset
- asv1: Verify the amount of extradata
- idroqdec: Make sure a video stream has been allocated before returning packets
- rv10: Validate the dimensions set from the container
- xmv: Add more sanity checks for parameters read from the bitstream
- ffv1: Make sure at least one slice context is initialized
- truemotion2: Use av_freep properly in an error path
- eacmv: Make sure a reference frame exists before referencing it
- mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
- ivi_common: Make sure color planes have been initialized
- 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
- 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
- mpc8: Check the seek table size parsed from the bitstream
- zmbvdec: Check the buffer size for uncompressed data
- ape: Don't allow the seektable to be omitted
- shorten: Break out of loop looking for fmt chunk if none is found
- shorten: Use a checked bytestream reader for the wave header
- smacker: Make sure we don't fill in huffman codes out of range
- smacker: Avoid integer overflow when allocating packets
- smacker: Don't return packets in unallocated streams
- dsicin: Add some basic sanity checks for fields read from the file
- roqvideodec: check dimensions validity
- qdm2: check array index before use, fix out of array accesses
- alsdec: check block length
version 0.10.10
- x86: fft: Remove 3DNow! optimizations, they break FATE
- x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16
- aac: Check init_get_bits return value
- aac: return meaningful errors
- dsicinav: K&R formatting cosmetics
- mov: Seek back if overreading an individual atom
- vcr1: add sanity checks
- pictordec: pass correct context to avpriv_request_sample
- dsicinav: Clip the source size to the expected maximum
- alsdec: Clean up error paths
- ogg: Fix potential infinite discard loop
- nuv: check rtjpeg_decode_frame_yuv420 return value
- nuv: Reset the frame on resize
- nuv: Use av_fast_realloc
- nuv: return meaningful error codes.
- nuv: Pad the lzo outbuf
- nuv: Do not ignore lzo decompression failures
- oma: correctly mark and decrypt partial packets
- oma: check geob tag boundary
- oma: refactor seek function
- 8bps: Bound-check the input buffer
- rtmp: Do not misuse memcmp
- rtmp: rename data_size to size
- lavc: set the default rc_initial_buffer_occupancy
- 4xm: Reject not a multiple of 16 dimension
- 4xm: do not overread the prestream buffer
- 4xm: validate the buffer size before parsing it
- indeo: Do not reference mismatched tiles
- indeo: Sanitize ff_ivi_init_planes fail paths
- indeo: Bound-check before applying motion compensation
- indeo: Bound-check before applying transform
- indeo: reject negative array indexes
- indeo: Cosmetic formatting
- indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
- indeo: Refactor ff_ivi_dec_huff_desc
- lavf: fix the comparison in an overflow check
- dv: Add a guard to not overread the ppcm array
- mpegvideo: Avoid 32-bit wrapping of linesize multiplications
- mjpegb: Detect changing number of planes in interlaced video
- matroskadec: Check that .lang was allocated and set before reading it
- ape demuxer: check for EOF in potentially long loops
- lavf: avoid integer overflow when estimating bitrate
- pictordec: break out of both decoding loops when y drops below 0
- ac3: Return proper error codes
- ac3: Clean up the error paths
- ac3: Do not clash with normal AVERROR
- dxa: Make sure the reference frame exists
- h261: check the mtype index
- segafilm: Error out on impossible packet size
- ogg: Always alloc the private context in vorbis_header
- vc1: check mb_height validity.
- vc1: check the source buffer in vc1_mc functions
- bink: Bound check the quantization matrix.
- xl: Make sure the width is valid
- alsdec: Fix the clipping range
- dsicinav: Bound-check the source buffer when needed
- mov: Do not allow updating the time scale after it has been set
- ac3dec: Don't consume more data than the actual input packet size
- indeo: Reject impossible FRAMETYPE_NULL
- indeo5: return proper error codes
- indeo4: Validate scantable dimension
- indeo4: Check the quantization matrix index
- indeo4: Do not access missing reference MV
- adpcm: Unbreak ima-dk4
- ac3dec: validate channel output mode against channel count
- dca: Respect the current limits in the downmixing capabilities
- dca: Error out on missing DSYNC
- pcm: always use codec->id instead of codec_id
- mlpdec: Do not set invalid context in read_restart_header
- pcx: Do not overread source buffer in pcx_rle_decode
- wmavoice: conceal clearly corrupted blocks
- iff: Do not read over the source buffer
- qdm2: Conceal broken samples
- qdm2: refactor joined stereo support
- adpcm: Write the correct number of samples for ima-dk4
- imc: Catch a division by zero
- atrac3: Error on impossible encoding/channel combinations
- atrac3: set the getbits context the right buffer_end
- atrac3: fix error handling
- qdm2: check and reset dithering index per channel
- westwood_vqa: do not free extradata on error in read_header
- vqavideo: check the version
- rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
- avio: Handle AVERROR_EOF in the same way as the return value 0
- wtv: Mark attachment with a negative stream id
- avidec: Let the inner dv demuxer take care of discarding
- swfdec: do better validation of tag length
version 0.10.8
- kmvc: Clip pixel position to valid range
- kmvc: use fixed sized arrays in the context
- indeo: use a typedef for the mc function pointer
- lavc: check for overflow in init_get_bits
- mjpegdec: properly report unsupported disabled features
- jpegls: return meaningful errors
- jpegls: factorize return paths
- jpegls: check the scan offset
- wavpack: validate samples size parsed in wavpack_decode_block
- ljpeg: use the correct number of components in yuv
- mjpeg: Validate sampling factors
- mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
- wavpack: check packet size early
- wavpack: return meaningful errors
- apetag: use int64_t for filesize
- tiff: do not overread the source buffer
- Prepare for 0.8.8 Release
- smacker: fix an off by one in huff.length computation
- smacker: check the return value of smacker_decode_tree
- smacker: pad the extradata allocation
- smacker: check frame size validity
- vmdav: convert to bytestream2
- 4xm: don't rely on get_buffer() initializing the frame.
- 4xm: check the return value of read_huffman_tables().
- 4xm: use the correct logging context
- 4xm: reject frames not compatible with the declared version
- 4xm: check bitstream_size boundary before using it
- 4xm: do not overread the source buffer in decode_p_block
- avfiltergraph: check for sws opts being non-NULL before using them
- bmv: check for len being valid in bmv_decode_frame()
- dfa: check for invalid access in decode_wdlt()
- indeo3: check motion vectors
- indeo3: fix data size check
- indeo3: switch parsing the header to bytestream2
- lavf: make sure stream probe data gets freed.
- oggdec: fix faulty cleanup prototype
- oma: Validate sample rates
- qdm2: check that the FFT size is a power of 2
- rv10: check that extradata is large enough
- xmv: check audio track parameters validity
- xmv: do not leak memory in the error paths in xmv_read_header()
- aac: check the maximum number of channels
- indeo3: fix off by one in MV validity check, Bug #503
- id3v2: check for end of file while unescaping tags
- wav: Always seek to an even offset, Bug #500, LP: #1174737
- proresdec: support mixed interlaced/non-interlaced content
version 0.10.6:
- many bug fixes that where found with Coverity
- The following CVE fixes where backported:
CVE-2012-2796, CVE-2012-2775, CVE-2012-2772, CVE-2012-2776,
CVE-2012-2779, CVE-2012-2787, CVE-2012-2794, CVE-2012-2800,
CVE-2012-2802, CVE-2012-2801, CVE-2012-2786, CVE-2012-2798,
CVE-2012-2793, CVE-2012-2789, CVE-2012-2788, CVE-2012-2790,
CVE-2012-2777, CVE-2012-2784
- hundreads of other bug fixes, some possibly security relevant,
see the git log for details.
version 0.10.5:
- Several bugs and crashes have been fixed as well as build problems
with recent mingw64
version 0.10.4:
- Several bugs and crashes have been fixed
Note, CVE-2012-0851 and CVE-2011-3937 have been fixed in previous releases
version 0.10.3:
- Security fixes in the 4xm demuxer, avi demuxer, cook decoder,
mm demuxer, mpegvideo decoder, vqavideo decoder (CVE-2012-0947) and
xmv demuxer.
- Several bugs and crashes have been fixed in the following codecs: AAC,
APE, H.263, H.264, Indeo 4, Mimic, MJPEG, Motion Pixels Video, RAW,
TTA, VC1, VQA, WMA Voice, vqavideo.
- Several bugs and crashes have been fixed in the following formats:
ASF, ID3v2, MOV, xWMA
- This release additionally updates the following codecs to the
bytestream2 API, and therefore benefit from additional overflow
checks: truemotion2, utvideo, vqavideo
version 0.10.1
- Several security fixes, many bugfixes affecting many formats and
codecs, the list below is not complete.
- swapuv filter
- Several bugs and crashes have been fixed in the following codecs: AAC,
AC-3, ADPCM, AMR (both NB and WB), ATRAC3, CAVC, Cook, camstudio, DCA,
DPCM, DSI CIN, DV, EA TGQ, FLAC, fraps, G.722 (both encoder and
decoder), H.264, huvffyuv, BB JV decoder, Indeo 3, KGV1, LCL, the
libx264 wrapper, MJPEG, mp3on4, Musepack, MPEG1/2, PNG, QDM2, Qt RLE,
ROQ, RV10, RV30/RV34/RV40, shorten, smacker, subrip, SVQ3, TIFF,
Truemotion2, TTA, VC1, VMware Screen codec, Vorbis, VP5, VP6, WMA,
Westwood SNDx, XXAN.
- This release additionally updates the following codecs to the
bytestream2 API, and therefore benefit from additional overflow
checks: XXAN, ALG MM, TQG, SMC, Qt SMC, ROQ, PNG
- Several bugs and crashes have been fixed in the following formats:
AIFF, ASF, DV, Matroska, NSV, MOV, MPEG-TS, Smacker, Sony OpenMG, RM,
SWF.
- Libswscale has an potential overflow for large image size fixed.
- The following APIs have been added:
avcodec_is_open()
avformat_get_riff_video_tags()
avformat_get_riff_audio_tags()
Please see the file doc/APIchanges and the Doxygen documentation for
further information.
version 0.10:
- Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936,
CVE-2011-3937, CVE-2011-3940, CVE-2011-3941, CVE-2011-3944,

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER =
PROJECT_NUMBER = 0.10.16
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55

View File

@@ -14,7 +14,6 @@ and related discussions.
Project Leader
==============
Michael Niedermayer
final design decisions

View File

@@ -137,7 +137,6 @@ uninstall-data:
clean::
$(RM) $(ALLPROGS) $(ALLPROGS_G)
$(RM) $(CLEANSUFFIXES)
$(RM) $(TOOLS)
$(RM) $(CLEANSUFFIXES:%=tools/%)
$(RM) coverage.info
$(RM) -r coverage-html
@@ -158,6 +157,8 @@ coverage-html: coverage.info
$(Q)genhtml -o $@ $<
$(Q)touch $@
check: all alltools checkheaders examples testprogs fate
include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/tests/Makefile
@@ -172,5 +173,5 @@ $(sort $(OBJDIRS)):
# so this saves some time on slow systems.
.SUFFIXES:
.PHONY: all all-yes alltools *clean config examples install*
.PHONY: all all-yes alltools check *clean config examples install*
.PHONY: testprogs uninstall*

View File

@@ -1 +1 @@
0.9.1.git
0.10.16

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.10.16

View File

@@ -56,7 +56,7 @@
struct SwsContext *sws_opts;
AVDictionary *format_opts, *codec_opts;
const int this_year = 2012;
const int this_year = 2015;
static FILE *report_file;
@@ -423,7 +423,10 @@ int opt_default(const char *opt, const char *arg)
const AVOption *oc, *of, *os;
char opt_stripped[128];
const char *p;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
#if CONFIG_SWSCALE
const AVClass *sc = sws_get_class();
#endif
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
@@ -438,7 +441,6 @@ int opt_default(const char *opt, const char *arg)
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
av_dict_set(&format_opts, opt, arg, FLAGS(of));
#if CONFIG_SWSCALE
sc = sws_get_class();
if ((os = av_opt_find(&sc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
// XXX we only support sws_flags, not arbitrary sws options
@@ -806,7 +808,7 @@ int opt_codecs(const char *opt, const char *arg)
if (p2 && strcmp(p->name, p2->name) == 0) {
if (p->decode)
decode = 1;
if (p->encode)
if (p->encode || p->encode2)
encode = 1;
cap |= p->capabilities;
}

View File

@@ -117,4 +117,13 @@ CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
define RULES
clean::
$(RM) $(OBJS) $(OBJS:.o=.d)
$(RM) $(HOSTPROGS)
$(RM) $(TOOLS)
endef
$(eval $(RULES))
-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))

42
configure vendored
View File

@@ -54,6 +54,8 @@ if test "$E1" != 0 || test "$E2" = 0; then
exit 1
fi
test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
show_help(){
cat <<EOF
Usage: configure [options]
@@ -688,6 +690,13 @@ check_ld(){
check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
}
print_include(){
hdr=$1
test "${hdr%.h}" = "${hdr}" &&
echo "#include $hdr" ||
echo "#include <$hdr>"
}
check_cppflags(){
log check_cppflags "$@"
set -- $($filter_cppflags "$@")
@@ -765,7 +774,7 @@ check_func_headers(){
shift 2
{
for hdr in $headers; do
echo "#include <$hdr>"
print_include $hdr
done
for func in $funcs; do
echo "long check_$func(void) { return (long) $func; }"
@@ -1168,6 +1177,7 @@ HAVE_LIST="
dlfcn_h
dlopen
dos_paths
dxva_h
ebp_available
ebx_available
exp2
@@ -2559,7 +2569,7 @@ check_host_cflags -std=c99
check_host_cflags -Wall
case "$arch" in
alpha|ia64|mips|parisc|sparc)
alpha|ia64|mips|parisc|ppc|sparc)
spic=$shared
;;
x86)
@@ -2899,17 +2909,14 @@ elif enabled ppc; then
check_cc <<EOF || disable altivec
$inc_altivec_h
int main(void) {
vector signed int v1, v2, v3;
v1 = vec_add(v2,v3);
vector signed int v1 = (vector signed int) { 0 };
vector signed int v2 = (vector signed int) { 1 };
v1 = vec_add(v1, v2);
return 0;
}
EOF
# check if our compiler supports braces for vector declarations
check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
$inc_altivec_h
int main (void) { (vector int) {1}; return 0; }
EOF
enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
fi
elif enabled sparc; then
@@ -2981,6 +2988,7 @@ if enabled asm; then
fi
check_ldflags -Wl,--as-needed
check_ldflags -Wl,-z,noexecstack
if check_func dlopen; then
ldl=
@@ -3047,6 +3055,7 @@ check_func_headers windows.h MapViewOfFile
check_func_headers windows.h VirtualAlloc
check_header dlfcn.h
check_header dxva.h
check_header dxva2api.h -D_WIN32_WINNT=0x0600
check_header libcrystalhd/libcrystalhd_if.h
check_header malloc.h
@@ -3135,7 +3144,7 @@ enabled libdirac && require_pkg_config dirac \
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
"dirac_decoder_init dirac_encoder_init"
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
@@ -3201,7 +3210,14 @@ makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
check_header linux/fb.h
check_header linux/videodev.h
check_header linux/videodev2.h
check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
check_cc <<EOF && enable_safe struct_v4l2_frmivalenum_discrete
#include <linux/videodev2.h>
int main(void) {
struct v4l2_frmsizeenum vfse;
vfse.discrete.width = 0;
return 0;
}
EOF
check_header sys/videoio.h
@@ -3354,11 +3370,15 @@ elif enabled gcc; then
check_cflags -fno-tree-vectorize
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
check_cflags -Werror=return-type
elif enabled llvm_gcc; then
check_cflags -mllvm -stack-alignment=16
elif enabled clang; then
check_cflags -mllvm -stack-alignment=16
check_cflags -Qunused-arguments
check_cflags -Werror=return-type
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
elif enabled armcc; then
# 2523: use of inline assembler is deprecated
add_cflags -W${armcc_opt},--diag_suppress=2523

View File

@@ -13,24 +13,40 @@ libavutil: 2011-04-18
API changes, most recent first:
2014-09-16 - 8637f4e - lavu 51.22.3 - cpu.h
Add AV_CPU_FLAG_CMOV.
2012-01-24 - xxxxxxx - lavfi 2.60.100
Add avfilter_graph_dump.
2012-01-25 - lavf 53.22.0
f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
2012-01-25 - lavf 53.31.100 / 53.22.0
3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for
muxers supporting it (av_write_frame makes sure it is called
only for muxers with this flag).
2012-01-15 - lavc 53.34.0
2012-03-04 - 7f3f855 - lavu 51.22.1 - error.h
Add AVERROR_UNKNOWN
2012-02-29 - 2ad77c6 - lavf 53.21.1
Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
2012-02-29 - a1556d3 - lavu 51.22.0 - intfloat.h
Add a new installed header libavutil/intfloat.h with int/float punning
functions.
2012-02-17 - 350d06d - lavc 53.35.0
Add avcodec_is_open() function.
2012-01-15 - lavc 53.56.105 / 53.34.0
New audio encoding API:
b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
encoders.
5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
67f5650 / 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
67f5650 / b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
Add AVCodec.encode2().
2012-01-12 - 3167dc9 - lavfi 2.15.0
2012-01-12 - b18e17e / 3167dc9 - lavfi 2.59.100 / 2.15.0
Add a new installed header -- libavfilter/version.h -- with version macros.
2011-12-08 - a502939 - lavfi 2.52.0
@@ -51,37 +67,37 @@ API changes, most recent first:
2011-10-20 - b35e9e1 - lavu 51.22.0
Add av_strtok() to avstring.h.
2011-01-03 - b73ec05 - lavu 51.21.0
2012-01-03 - ad1c8dd / b73ec05 - lavu 51.34.100 / 51.21.0
Add av_popcount64
2011-12-18 - 8400b12 - lavc 53.28.1
2011-12-18 - 7c29313 / 8400b12 - lavc 53.46.1 / 53.28.1
Deprecate AVFrame.age. The field is unused.
2011-12-12 - 5266045 - lavf 53.17.0
2011-12-12 - 8bc7fe4 / 5266045 - lavf 53.25.0 / 53.17.0
Add avformat_close_input().
Deprecate av_close_input_file() and av_close_input_stream().
2011-12-02 - 0eea212 - lavc 53.25.0
2011-12-02 - e4de716 / 0eea212 - lavc 53.40.0 / 53.25.0
Add nb_samples and extended_data fields to AVFrame.
Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE.
Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4().
avcodec_decode_audio4() writes output samples to an AVFrame, which allows
audio decoders to use get_buffer().
2011-12-04 - 560f773 - lavc 53.24.0
2011-12-04 - e4de716 / 560f773 - lavc 53.40.0 / 53.24.0
Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump.
Change AVPicture.data[4]/linesize[4] to [8] at next major bump.
Change AVCodecContext.error[4] to [8] at next major bump.
Add AV_NUM_DATA_POINTERS to simplify the bump transition.
2011-11-23 - bbb46f3 - lavu 51.18.0
2011-11-23 - 8e576d5 / bbb46f3 - lavu 51.27.0 / 51.18.0
Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and
av_samples_alloc(), to samplefmt.h.
2011-11-23 - 8889cc4 - lavu 51.17.0
2011-11-23 - 8e576d5 / 8889cc4 - lavu 51.27.0 / 51.17.0
Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h.
2011-11-19 - f3a29b7 - lavc 53.21.0
2011-11-19 - dbb38bc / f3a29b7 - lavc 53.36.0 / 53.21.0
Move some AVCodecContext fields to a new private struct, AVCodecInternal,
which is accessed from a new field, AVCodecContext.internal.
- fields moved:
@@ -89,55 +105,55 @@ API changes, most recent first:
AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count
AVCodecContext.is_copy --> AVCodecInternal.is_copy
2011-11-16 - 6270671 - lavu 51.16.0
2011-11-16 - 8709ba9 / 6270671 - lavu 51.26.0 / 51.16.0
Add av_timegm()
2011-11-13 - lavf 53.15.0
2011-11-13 - lavf 53.21.0 / 53.15.0
New interrupt callback API, allowing per-AVFormatContext/AVIOContext
interrupt callbacks.
6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to
5f268ca / 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to
AVFormatContext.
1dee0ac Add avio_open2() with additional parameters. Those are
5f268ca / 1dee0ac Add avio_open2() with additional parameters. Those are
an interrupt callback and an options AVDictionary.
This will allow passing AVOptions to protocols after lavf
54.0.
2011-11-06 - ba04ecf - lavu 51.14.0
2011-11-06 - 13b7781 / ba04ecf - lavu 51.24.0 / 51.14.0
Add av_strcasecmp() and av_strncasecmp() to avstring.h.
2011-11-06 - 07b172f - lavu 51.13.0
2011-11-06 - 13b7781 / 07b172f - lavu 51.24.0 / 51.13.0
Add av_toupper()/av_tolower()
2011-11-05 - b6d08f4 - lavf 53.13.0
2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0
Add avformat_network_init()/avformat_network_uninit()
2011-10-27 - 512557b - lavc 53.15.0
2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0
Remove avcodec_parse_frame.
Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY.
2011-10-19 - 569129a - lavf 53.10.0
2011-10-19 - d049257 / 569129a - lavf 53.17.0 / 53.10.0
Add avformat_new_stream(). Deprecate av_new_stream().
2011-10-13 - b631fba - lavf 53.9.0
2011-10-13 - 91eb1b1 / b631fba - lavf 53.16.0 / 53.9.0
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.
2011-10-12 - lavu 51.12.0
2011-10-12 - lavu 51.21.0 / 51.12.0
AVOptions API rewrite.
- 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_*
- f884ef0 / 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_*
- new setting/getting functions with slightly different semantics:
dac66da av_set_string3 -> av_opt_set
f884ef0 / dac66da av_set_string3 -> av_opt_set
av_set_double -> av_opt_set_double
av_set_q -> av_opt_set_q
av_set_int -> av_opt_set_int
41d9d51 av_get_string -> av_opt_get
f884ef0 / 41d9d51 av_get_string -> av_opt_get
av_get_double -> av_opt_get_double
av_get_q -> av_opt_get_q
av_get_int -> av_opt_get_int
- 8c5dcaa trivial rename av_next_option -> av_opt_next
- 641c7af new functions - av_opt_child_next, av_opt_child_class_next
- f884ef0 / 8c5dcaa trivial rename av_next_option -> av_opt_next
- f884ef0 / 641c7af new functions - av_opt_child_next, av_opt_child_class_next
and av_opt_find2()
2011-09-22 - a70e787 - lavu 51.17.0
@@ -183,31 +199,31 @@ API changes, most recent first:
2011-08-20 - 69e2c1a - lavu 51.13.0
Add av_get_media_type_string().
2011-09-03 - fb4ca26 - lavc 53.13.0
2011-09-03 - 1889c67 / fb4ca26 - lavc 53.13.0
lavf 53.11.0
lsws 2.1.0
Add {avcodec,avformat,sws}_get_class().
2011-08-03 - c11fb82 - lavu 51.15.0
2011-08-03 - 1889c67 / c11fb82 - lavu 51.15.0
Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function.
2011-08-14 - 323b930 - lavu 51.12.0
Add av_fifo_peek2(), deprecate av_fifo_peek().
2011-08-26 - lavu 51.9.0
- add41de..abc78a5 Do not include intfloat_readwrite.h,
2011-08-26 - lavu 51.14.0 / 51.9.0
- 976a8b2 / add41de..976a8b2 / abc78a5 Do not include intfloat_readwrite.h,
mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h.
2011-08-16 - 48f9e45 - lavf 53.8.0
2011-08-16 - 27fbe31 / 48f9e45 - lavf 53.11.0 / 53.8.0
Add avformat_query_codec().
2011-08-16 - bca06e7 - lavc 53.11.0
2011-08-16 - 27fbe31 / bca06e7 - lavc 53.11.0
Add avcodec_get_type().
2011-08-06 - 2f63440 - lavf 53.7.0
2011-08-06 - 0cb233c / 2f63440 - lavf 53.7.0
Add error_recognition to AVFormatContext.
2011-08-02 - 9d39cbf - lavc 53.9.1
2011-08-02 - 1d186e9 / 9d39cbf - lavc 53.9.1
Add AV_PKT_FLAG_CORRUPT AVPacket flag.
2011-07-16 - b57df29 - lavfi 2.27.0
@@ -218,10 +234,10 @@ API changes, most recent first:
avfilter_set_common_packing_formats()
avfilter_all_packing_formats()
2011-07-10 - a67c061 - lavf 53.6.0
2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0
Add avformat_find_stream_info(), deprecate av_find_stream_info().
2011-07-10 - 0b950fe - lavc 53.8.0
2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0
Add avcodec_open2(), deprecate avcodec_open().
2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h
@@ -260,35 +276,35 @@ API changes, most recent first:
2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse()
Change avfilter_graph_parse() signature.
2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h
2011-06-23 - 686959e / 67e9ae1 - lavu 51.10.0 / 51.8.0 - attributes.h
Add av_printf_format().
2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h
2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h
Add avformat_open_input and avformat_write_header().
Deprecate av_open_input_stream, av_open_input_file,
AVFormatParameters and av_write_header.
2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h
2011-06-16 - 2905e3f / 7e83e1c, 2905e3f / dc59ec5 - lavu 51.9.0 / 51.7.0 - opt.h
Add av_opt_set_dict() and av_opt_find().
Deprecate av_find_opt().
Add AV_DICT_APPEND flag.
2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h
2011-06-10 - 45fb647 / cb7c11c - lavu 51.6.0 - opt.h
Add av_opt_flag_is_set().
2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata
2011-06-09 - f9ecb84 / d9f80ea - lavu 51.8.0 - AVMetadata
Move AVMetadata from lavf to lavu and rename it to
AVDictionary -- new installed header dict.h.
All av_metadata_* functions renamed to av_dict_*.
2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample()
2011-06-07 - d552f61 / a6703fa - lavu 51.8.0 - av_get_bytes_per_sample()
Add av_get_bytes_per_sample() in libavutil/samplefmt.h.
Deprecate av_get_bits_per_sample_fmt().
2011-06-05 - b39b062 - lavu 51.8.0 - opt.h
2011-06-05 - f956924 / b39b062 - lavu 51.8.0 - opt.h
Add av_opt_free convenience function.
2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps
@@ -318,7 +334,7 @@ API changes, most recent first:
Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h
2011-05-25 - 39e4206 / 30315a8 - lavf 53.3.0 - avformat.h
Add fps_probe_size to AVFormatContext.
2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h
@@ -334,10 +350,10 @@ API changes, most recent first:
2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h
Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt
2011-05-18 - 75a37b5 / 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt
Add request_sample_fmt field to AVCodecContext.
2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h
2011-05-10 - 59eb12f / 188dea1 - lavc 53.6.0 - avcodec.h
Deprecate AVLPCType and the following fields in
AVCodecContext: lpc_coeff_precision, prediction_order_method,
min_partition_order, max_partition_order, lpc_type, lpc_passes.
@@ -367,81 +383,81 @@ API changes, most recent first:
Add av_dynarray_add function for adding
an element to a dynamic array.
2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h
2011-04-26 - d7e5aeb / bebe72f - lavu 51.1.0 - avutil.h
Add AVPictureType enum and av_get_picture_type_char(), deprecate
FF_*_TYPE defines and av_get_pict_type_char() defined in
libavcodec/avcodec.h.
2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h
2011-04-26 - d7e5aeb / 10d3940 - lavfi 2.3.0 - avfilter.h
Add pict_type and key_frame fields to AVFilterBufferRefVideo.
2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
2011-04-26 - d7e5aeb / 7a11c82 - lavfi 2.2.0 - vsrc_buffer
Add sample_aspect_ratio fields to vsrc_buffer arguments
2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
2011-04-21 - 8772156 / 94f7451 - lavc 53.1.0 - avcodec.h
Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
2011-04-15 - lavc 52.120.0 - avcodec.h
AVPacket structure got additional members for passing side information:
4de339e introduce side information for AVPacket
2d8591c make containers pass palette change in AVPacket
c407984 / 4de339e introduce side information for AVPacket
c407984 / 2d8591c make containers pass palette change in AVPacket
2011-04-12 - lavf 52.107.0 - avio.h
Avio cleanup, part II - deprecate the entire URLContext API:
175389c add avio_check as a replacement for url_exist
ff1ec0c add avio_pause and avio_seek_time as replacements
c55780d / 175389c add avio_check as a replacement for url_exist
9891004 / ff1ec0c add avio_pause and avio_seek_time as replacements
for _av_url_read_fseek/fpause
cdc6a87 deprecate av_protocol_next(), avio_enum_protocols
d4d0932 / cdc6a87 deprecate av_protocol_next(), avio_enum_protocols
should be used instead.
80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb.
f87b1b3 rename open flags: URL_* -> AVIO_*
f8270bb add avio_enum_protocols.
5593f03 deprecate URLProtocol.
c486dad deprecate URLContext.
026e175 deprecate the typedef for URLInterruptCB
8e76a19 deprecate av_register_protocol2.
b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME
1305d93 deprecate av_url_read_seek
fa104e1 deprecate av_url_read_pause
727c7aa deprecate url_get_filename().
5958df3 deprecate url_max_packet_size().
1869ea0 deprecate url_get_file_handle().
32a97d4 deprecate url_filesize().
e52a914 deprecate url_close().
58a48c6 deprecate url_seek().
925e908 deprecate url_write().
dce3756 deprecate url_read_complete().
bc371ac deprecate url_read().
0589da0 deprecate url_open().
62eaaea deprecate url_connect.
5652bb9 deprecate url_alloc.
333e894 deprecate url_open_protocol
e230705 deprecate url_poll and URLPollEntry
c88caa5 / 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb.
c88caa5 / f87b1b3 rename open flags: URL_* -> AVIO_*
d4d0932 / f8270bb add avio_enum_protocols.
d4d0932 / 5593f03 deprecate URLProtocol.
d4d0932 / c486dad deprecate URLContext.
d4d0932 / 026e175 deprecate the typedef for URLInterruptCB
c88caa5 / 8e76a19 deprecate av_register_protocol2.
11d7841 / b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME
11d7841 / 1305d93 deprecate av_url_read_seek
11d7841 / fa104e1 deprecate av_url_read_pause
434f248 / 727c7aa deprecate url_get_filename().
434f248 / 5958df3 deprecate url_max_packet_size().
434f248 / 1869ea0 deprecate url_get_file_handle().
434f248 / 32a97d4 deprecate url_filesize().
434f248 / e52a914 deprecate url_close().
434f248 / 58a48c6 deprecate url_seek().
434f248 / 925e908 deprecate url_write().
434f248 / dce3756 deprecate url_read_complete().
434f248 / bc371ac deprecate url_read().
434f248 / 0589da0 deprecate url_open().
434f248 / 62eaaea deprecate url_connect.
434f248 / 5652bb9 deprecate url_alloc.
434f248 / 333e894 deprecate url_open_protocol
434f248 / e230705 deprecate url_poll and URLPollEntry
2011-04-08 - lavf 52.106.0 - avformat.h
Minor avformat.h cleanup:
a9bf9d8 deprecate av_guess_image2_codec
c3675df rename avf_sdp_create->av_sdp_create
d4d0932 / a9bf9d8 deprecate av_guess_image2_codec
d4d0932 / c3675df rename avf_sdp_create->av_sdp_create
2011-04-03 - lavf 52.105.0 - avio.h
Large-scale renaming/deprecating of AVIOContext-related functions:
724f6a0 deprecate url_fdopen
403ee83 deprecate url_open_dyn_packet_buf
6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf
b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf
8978fed introduce an AVIOContext.seekable field as a replacement for
2cae980 / 724f6a0 deprecate url_fdopen
2cae980 / 403ee83 deprecate url_open_dyn_packet_buf
2cae980 / 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf
2cae980 / b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf
2cae980 / 8978fed introduce an AVIOContext.seekable field as a replacement for
AVIOContext.is_streamed and url_is_streamed()
b64030f deprecate get_checksum()
4c4427a deprecate init_checksum()
4ec153b deprecate udp_set_remote_url/get_local_port
933e90a deprecate av_url_read_fseek/fpause
8d9769a deprecate url_fileno
b7f2fdd rename put_flush_packet -> avio_flush
35f1023 deprecate url_close_buf
83fddae deprecate url_open_buf
d9d86e0 rename url_fprintf -> avio_printf
59f65d9 deprecate url_setbufsize
3e68b3b deprecate url_ferror
1caa412 / b64030f deprecate get_checksum()
1caa412 / 4c4427a deprecate init_checksum()
2fd41c9 / 4ec153b deprecate udp_set_remote_url/get_local_port
4fa0e24 / 933e90a deprecate av_url_read_fseek/fpause
4fa0e24 / 8d9769a deprecate url_fileno
0fecf26 / b7f2fdd rename put_flush_packet -> avio_flush
0fecf26 / 35f1023 deprecate url_close_buf
0fecf26 / 83fddae deprecate url_open_buf
0fecf26 / d9d86e0 rename url_fprintf -> avio_printf
0fecf26 / 59f65d9 deprecate url_setbufsize
6947b0c / 3e68b3b deprecate url_ferror
e8bb2e2 deprecate url_fget_max_packet_size
76aa876 rename url_fsize -> avio_size
e519753 deprecate url_fgetc
@@ -462,7 +478,7 @@ API changes, most recent first:
b3db9ce deprecate get_partial_buffer
8d9ac96 rename av_alloc_put_byte -> avio_alloc_context
2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
2011-03-25 - 27ef7b1 / 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
Add audio_service_type field to AVCodecContext.
2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h
@@ -500,11 +516,11 @@ API changes, most recent first:
2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition
Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED.
2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init()
2011-02-09 - c0b102c - lavc 52.112.0 - avcodec_thread_init()
Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead
set thread_count before calling avcodec_open.
2011-02-09 - 778b08a - lavc 52.111.0 - threading API
2011-02-09 - 37b00b4 - lavc 52.111.0 - threading API
Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/
release_buffer()/draw_horiz_band() callbacks for appropriate codecs.
Add thread_type and active_thread_type fields to AVCodecContext.

View File

@@ -187,8 +187,8 @@ the following snippet into your @file{.vimrc}:
set expandtab
set shiftwidth=4
set softtabstop=4
" allow tabs in Makefiles
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=8
" Allow tabs in Makefiles.
autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
" Trailing whitespace and tabs are forbidden, so highlight them.
highlight ForbiddenWhitespace ctermbg=red guibg=red
match ForbiddenWhitespace /\s\+$\|\t/

File diff suppressed because it is too large Load Diff

View File

@@ -407,6 +407,10 @@ prefix is ``ffmpeg2pass''. The complete file name will be
@file{PREFIX-N.log}, where N is a number specific to the output
stream
Note that this option is overwritten by a local option of the same name
when using @code{-vcodec libx264}. That option maps to the x264 option stats
which has a different syntax.
@item -vlang @var{code}
Set the ISO 639 language code (3 letters) of the current video stream.

View File

@@ -82,7 +82,7 @@ Follows a BNF description for the filtergraph syntax:
@var{LINKLABEL} ::= "[" @var{NAME} "]"
@var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
@var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
@var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
@var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
@var{FILTERGRAPH} ::= @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
@@ -2549,6 +2549,9 @@ For example:
will create two separate outputs from the same input, one cropped and
one padded.
@section swapuv
Swap U & V plane.
@section thumbnail
Select the most representative frame in a given sequence of consecutive frames.

View File

@@ -24,7 +24,7 @@ a mail for every change to every issue.
The subscription URL for the ffmpeg-trac list is:
http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac
The URL of the webinterface of the tracker is:
http(s)://ffmpeg.org/trac/ffmpeg
http(s)://trac.ffmpeg.org
Type:
-----

View File

@@ -51,14 +51,15 @@ The toolchain provided with Xcode is sufficient to build the basic
unacelerated code.
Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
@url{http://github.com/yuvi/gas-preprocessor} to build the optimized
assembler functions. Just download the Perl script and put it somewhere
@url{https://github.com/FFmpeg/gas-preprocessor} or
@url{https://github.com/yuvi/gas-preprocessor} to build the optimized
assembler functions. Put the Perl script somewhere
in your PATH, FFmpeg's configure will pick it up automatically.
Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
optimized assembler functions. @uref{http://www.finkproject.org/, Fink},
@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix},
@uref{http://mxcl.github.com/homebrew/, Homebrew}
@uref{https://mxcl.github.com/homebrew/, Homebrew}
or @uref{http://www.macports.org, MacPorts} can easily provide it.

View File

@@ -242,7 +242,7 @@ data transferred over RDT).
The muxer can be used to send a stream using RTSP ANNOUNCE to a server
supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
@uref{http://github.com/revmischa/rtsp-server, RTSP server}).
@uref{https://github.com/revmischa/rtsp-server, RTSP server}).
The required syntax for a RTSP url is:
@example

View File

@@ -505,7 +505,7 @@ static int alloc_buffer(AVCodecContext *s, InputStream *ist, FrameBuffer **pbuf)
const int v_shift = i==0 ? 0 : v_chroma_shift;
if (s->flags & CODEC_FLAG_EMU_EDGE)
buf->data[i] = buf->base[i];
else
else if (buf->base[i])
buf->data[i] = buf->base[i] +
FFALIGN((buf->linesize[i]*edge >> v_shift) +
(pixel_size*edge >> h_shift), 32);
@@ -2626,32 +2626,35 @@ static int transcode_init(OutputFile *output_files, int nb_output_files,
break;
}
/* two pass mode */
if (codec->codec_id != CODEC_ID_H264 &&
(codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
if (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) {
char logfilename[1024];
FILE *f;
snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
i);
if (codec->flags & CODEC_FLAG_PASS2) {
char *logbuffer;
size_t logbuffer_size;
if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
logfilename);
exit_program(1);
if (!strcmp(ost->enc->name, "libx264")) {
av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
} else {
if (codec->flags & CODEC_FLAG_PASS2) {
char *logbuffer;
size_t logbuffer_size;
if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
logfilename);
exit_program(1);
}
codec->stats_in = logbuffer;
}
codec->stats_in = logbuffer;
}
if (codec->flags & CODEC_FLAG_PASS1) {
f = fopen(logfilename, "wb");
if (!f) {
av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
logfilename, strerror(errno));
exit_program(1);
if (codec->flags & CODEC_FLAG_PASS1) {
f = fopen(logfilename, "wb");
if (!f) {
av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
logfilename, strerror(errno));
exit_program(1);
}
ost->logfile = f;
}
ost->logfile = f;
}
}
}
@@ -4054,8 +4057,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
if (p) p++;
}
video_enc->rc_override_count = i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size * 3 / 4;
video_enc->intra_dc_precision = intra_dc_precision - 8;
if (do_psnr)
@@ -4065,9 +4066,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
if (do_pass) {
if (do_pass & 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
av_dict_set(&ost->opts, "flags", "+pass1", AV_DICT_APPEND);
}
if (do_pass & 2) {
video_enc->flags |= CODEC_FLAG_PASS2;
av_dict_set(&ost->opts, "flags", "+pass2", AV_DICT_APPEND);
}
}
@@ -4693,7 +4696,8 @@ static int opt_target(OptionsContext *o, const char *opt, const char *arg)
for (j = 0; j < nb_input_files; j++) {
for (i = 0; i < input_files[j].nb_streams; i++) {
AVCodecContext *c = input_files[j].ctx->streams[i]->codec;
if (c->codec_type != AVMEDIA_TYPE_VIDEO)
if (c->codec_type != AVMEDIA_TYPE_VIDEO ||
!c->time_base.num)
continue;
fr = c->time_base.den * 1000 / c->time_base.num;
if (fr == 25000) {

View File

@@ -1611,7 +1611,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
if (pic->data[0] == NULL) {
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return codec->get_buffer(codec, pic);
return input_get_buffer(codec, pic);
}
if ((codec->width != ref->video->w) || (codec->height != ref->video->h) ||

View File

@@ -1790,6 +1790,10 @@ int main(int argc, char **argv)
if (!print_format)
print_format = av_strdup("default");
if (!print_format) {
ret = AVERROR(ENOMEM);
goto end;
}
w_name = av_strtok(print_format, "=", &buf);
w_args = buf;

View File

@@ -562,9 +562,11 @@ static void start_multicast(void)
default_port = 6000;
for(stream = first_stream; stream != NULL; stream = stream->next) {
if (stream->is_multicast) {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
/* open the RTP connection */
snprintf(session_id, sizeof(session_id), "%08x%08x",
av_lfg_get(&random_state), av_lfg_get(&random_state));
random0, random1);
/* choose a port if none given */
if (stream->multicast_port == 0) {
@@ -3086,9 +3088,12 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
found:
/* generate session id if needed */
if (h->session_id[0] == '\0')
if (h->session_id[0] == '\0') {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
snprintf(h->session_id, sizeof(h->session_id), "%08x%08x",
av_lfg_get(&random_state), av_lfg_get(&random_state));
random0, random1);
}
/* find rtp session, and create it if none found */
rtp_c = find_rtp_session(h->session_id);
@@ -3457,6 +3462,9 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
{
AVStream *fst;
if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
return NULL;
fst = av_mallocz(sizeof(AVStream));
if (!fst)
return NULL;
@@ -3802,6 +3810,9 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
{
AVStream *st;
if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
return;
/* compute default parameters */
switch(av->codec_type) {
case AVMEDIA_TYPE_AUDIO:

View File

@@ -25,6 +25,7 @@
*/
#include "libavutil/intreadwrite.h"
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
@@ -347,6 +348,10 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int lo
decode_p_block(f, dst , src , log2w, log2h, stride);
decode_p_block(f, dst + (1<<log2w), src + (1<<log2w), log2w, log2h, stride);
}else if(code == 3 && f->version<2){
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
mcdc(dst, src, log2w, h, stride, 1, 0);
}else if(code == 4){
if (f->g.buffer_end - f->g.buffer < 1){
@@ -368,6 +373,10 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int lo
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
}else if(code == 6){
if (f->g2.buffer_end - f->g2.buffer < 2){
@@ -394,6 +403,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset;
if(f->version>1){
if (length < 20)
return AVERROR_INVALIDDATA;
extra=20;
if (length < extra)
return -1;
@@ -551,7 +562,10 @@ static int decode_i_mb(FourXContext *f){
return 0;
}
static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf, int buf_size){
static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t * const buf,
int buf_size)
{
int frequency[512];
uint8_t flag[512];
int up[512];
@@ -572,6 +586,9 @@ static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const
if (start <= end && ptr_end - ptr < end - start + 1 + 1)
return NULL;
if (end < start || buf_size < 0)
return NULL;
for(i=start; i<=end; i++){
frequency[i]= *ptr++;
}
@@ -665,8 +682,8 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
color[0]= bytestream2_get_le16u(&g3);
color[1]= bytestream2_get_le16u(&g3);
if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
if(color[0]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 1\n");
if(color[1]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 2\n");
color[2]= mix(color[0], color[1]);
color[3]= mix(color[1], color[0]);
@@ -694,7 +711,10 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
unsigned int prestream_size;
const uint8_t *prestream;
if (bitstream_size > (1<<26) || length < bitstream_size + 12) {
if (bitstream_size > (1 << 26))
return AVERROR_INVALIDDATA;
if (length < bitstream_size + 12) {
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
return AVERROR_INVALIDDATA;
}
@@ -702,15 +722,19 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
prestream_size = 4 * AV_RL32(buf + bitstream_size + 4);
prestream = buf + bitstream_size + 12;
if (prestream_size > (1<<26) ||
prestream_size != length - (bitstream_size + 12)){
if(prestream_size + bitstream_size + 12 != length
|| prestream_size > (1<<26)){
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
return -1;
}
prestream= read_huffman_tables(f, prestream, buf + length - prestream);
if (!prestream)
return -1;
prestream = read_huffman_tables(f, prestream, prestream_size);
if (!prestream) {
av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
return AVERROR_INVALIDDATA;
}
av_assert0(prestream <= buf + length);
init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
@@ -751,25 +775,35 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame *p, temp;
int i, frame_4cc, frame_size;
if (buf_size < 12)
if (buf_size < 20)
return AVERROR_INVALIDDATA;
if (avctx->width % 16 || avctx->height % 16) {
av_log(avctx, AV_LOG_ERROR,
"Dimensions non-multiple of 16 are invalid.\n");
return AVERROR_INVALIDDATA;
frame_4cc= AV_RL32(buf);
if(buf_size != AV_RL32(buf+4)+8 || buf_size < 20){
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4));
}
if (buf_size < AV_RL32(buf + 4) + 8) {
av_log(f->avctx, AV_LOG_ERROR,
"size mismatch %d %d\n", buf_size, AV_RL32(buf + 4));
}
frame_4cc = AV_RL32(buf);
if(frame_4cc == AV_RL32("cfrm")){
int free_index=-1;
const int data_size= buf_size - 20;
const int id= AV_RL32(buf+12);
const int whole_size= AV_RL32(buf+16);
int id, whole_size;
const int data_size = buf_size - 20;
CFrameBuffer *cfrm;
id = AV_RL32(buf + 12);
whole_size = AV_RL32(buf + 16);
if (data_size < 0 || whole_size < 0){
av_log(f->avctx, AV_LOG_ERROR, "sizes invalid\n");
return AVERROR_INVALIDDATA;
}
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
@@ -805,6 +839,9 @@ static int decode_frame(AVCodecContext *avctx,
av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number);
}
if (f->version <= 1)
return AVERROR_INVALIDDATA;
cfrm->size= cfrm->id= 0;
frame_4cc= AV_RL32("pfrm");
}else
@@ -848,6 +885,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
memset(f->last_picture.data[0], 0, avctx->height * FFABS(f->last_picture.linesize[0]));
}
p->pict_type= AV_PICTURE_TYPE_P;
@@ -915,7 +953,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
av_freep(&f->cfrm[i].data);
f->cfrm[i].allocated_size= 0;
}
free_vlc(&f->pre_vlc);
ff_free_vlc(&f->pre_vlc);
if(f->current_picture.data[0])
avctx->release_buffer(avctx, &f->current_picture);
if(f->last_picture.data[0])

View File

@@ -69,7 +69,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
unsigned char *pixptr, *pixptr_end;
unsigned int height = avctx->height; // Real image height
unsigned int dlen, p, row;
const unsigned char *lp, *dp;
const unsigned char *lp, *dp, *ep;
unsigned char count;
unsigned int planes = c->planes;
unsigned char *planemap = c->planemap;
@@ -84,6 +84,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
return -1;
}
ep = encoded + buf_size;
/* Set data pointer after line lengths */
dp = encoded + planes * (height << 1);
@@ -95,16 +97,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
for(row = 0; row < height; row++) {
pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
pixptr_end = pixptr + c->pic.linesize[0];
if (ep - lp < row * 2 + 2)
return AVERROR_INVALIDDATA;
dlen = av_be2ne16(*(const unsigned short *)(lp+row*2));
/* Decode a row of this plane */
while(dlen > 0) {
if(dp + 1 >= buf+buf_size) return -1;
if(ep - dp <= 1) return -1;
if ((count = *dp++) <= 127) {
count++;
dlen -= count + 1;
if (pixptr + count * planes > pixptr_end)
break;
if(dp + count > buf+buf_size) return -1;
if(ep - dp < count) return -1;
while(count--) {
*pixptr = *dp++;
pixptr += planes;

View File

@@ -38,6 +38,7 @@
*/
#include "avcodec.h"
#include "internal.h"
/** decoder context */
typedef struct EightSvxContext {
@@ -47,7 +48,7 @@ typedef struct EightSvxContext {
/* buffer used to store the whole audio decoded/interleaved chunk,
* which is sent with the first packet */
uint8_t *samples;
size_t samples_size;
int64_t samples_size;
int samples_idx;
} EightSvxContext;
@@ -151,7 +152,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1) / avctx->channels;
if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -578,7 +578,8 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o
# libavformat dependencies
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_ADX_DEMUXER) += adx.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
ac3tab.o
OBJS-$(CONFIG_DV_DEMUXER) += dvdata.o
OBJS-$(CONFIG_DV_MUXER) += dvdata.o timecode.o
OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o vorbis_data.o
@@ -594,7 +595,7 @@ OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \
mpegaudiodata.o vorbis_data.o
OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o timecode.o
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o timecode.o
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o

View File

@@ -55,9 +55,13 @@ static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest)
for (y = blocky; y < blocky + 8 && y < C64YRES; y++) {
for (x = blockx; x < blockx + 8 && x < C64XRES; x += 2) {
if(x < width && y < height) {
/* build average over 2 pixels */
luma = (src[(x + 0 + y * p->linesize[0])] +
src[(x + 1 + y * p->linesize[0])]) / 2;
if (x + 1 < width) {
/* build average over 2 pixels */
luma = (src[(x + 0 + y * p->linesize[0])] +
src[(x + 1 + y * p->linesize[0])]) / 2;
} else {
luma = src[(x + y * p->linesize[0])];
}
/* write blocks as linear data now so they are suitable for elbg */
dest[0] = luma;
}

View File

@@ -28,13 +28,13 @@
#include "parser.h"
typedef enum {
AAC_AC3_PARSE_ERROR_SYNC = -1,
AAC_AC3_PARSE_ERROR_BSID = -2,
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3,
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -4,
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -5,
AAC_AC3_PARSE_ERROR_CRC = -6,
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7,
AAC_AC3_PARSE_ERROR_SYNC = -0x1030c0a,
AAC_AC3_PARSE_ERROR_BSID = -0x2030c0a,
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a,
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a,
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a,
AAC_AC3_PARSE_ERROR_CRC = -0x6030c0a,
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -0x7030c0a,
} AACAC3ParseError;
typedef struct AACAC3ParseContext {

View File

@@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int size;
union {
uint64_t u64;
uint8_t u8[8];
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
} tmp;
tmp.u64 = av_be2ne64(state);

View File

@@ -713,7 +713,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
const float lambda)
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
float dists[128], uplims[128];
float maxvals[128];
int fflag, minscaler;

View File

@@ -192,6 +192,8 @@ static av_cold int che_configure(AACContext *ac,
enum ChannelPosition che_pos[4][MAX_ELEM_ID],
int type, int id, int *channels)
{
if (*channels >= MAX_CHANNELS)
return AVERROR_INVALIDDATA;
if (che_pos[type][id]) {
if (!ac->che[type][id]) {
if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
@@ -360,7 +362,7 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
comment_len = get_bits(gb, 8) * 8;
if (get_bits_left(gb) < comment_len) {
av_log(avctx, AV_LOG_ERROR, overread_err);
return -1;
return AVERROR_INVALIDDATA;
}
skip_bits_long(gb, comment_len);
return 0;
@@ -381,7 +383,7 @@ static av_cold int set_default_channel_config(AVCodecContext *avctx,
if (channel_config < 1 || channel_config > 7) {
av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
channel_config);
return -1;
return AVERROR_INVALIDDATA;
}
/* default channel configurations:
@@ -499,20 +501,21 @@ static int decode_audio_specific_config(AACContext *ac,
int sync_extension)
{
GetBitContext gb;
int i;
int i, ret;
av_dlog(avctx, "extradata size %d\n", avctx->extradata_size);
for (i = 0; i < avctx->extradata_size; i++)
av_dlog(avctx, "%02x ", avctx->extradata[i]);
av_dlog(avctx, "\n");
init_get_bits(&gb, data, bit_size);
if ((ret = init_get_bits(&gb, data, bit_size)) < 0)
return ret;
if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size, sync_extension)) < 0)
return -1;
return AVERROR_INVALIDDATA;
if (m4ac->sampling_index > 12) {
av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
return -1;
return AVERROR_INVALIDDATA;
}
skip_bits_long(&gb, i);
@@ -521,13 +524,14 @@ static int decode_audio_specific_config(AACContext *ac,
case AOT_AAC_MAIN:
case AOT_AAC_LC:
case AOT_AAC_LTP:
if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config))
return -1;
if ((ret = decode_ga_specific_config(ac, avctx, &gb,
m4ac, m4ac->chan_config)) < 0)
return ret;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n",
m4ac->sbr == 1? "SBR+" : "", m4ac->object_type);
return -1;
return AVERROR(ENOSYS);
}
av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
@@ -598,16 +602,17 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
static av_cold int aac_decode_init(AVCodecContext *avctx)
{
AACContext *ac = avctx->priv_data;
int ret;
float output_scale_factor;
ac->avctx = avctx;
ac->m4ac.sample_rate = avctx->sample_rate;
if (avctx->extradata_size > 0) {
if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
avctx->extradata,
avctx->extradata_size*8, 1) < 0)
return -1;
avctx->extradata_size*8, 1)) < 0)
return ret;
} else {
int sr, i;
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
@@ -700,7 +705,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
if (get_bits_left(gb) < 8 * count) {
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
return -1;
return AVERROR_INVALIDDATA;
}
skip_bits_long(gb, 8 * count);
return 0;
@@ -714,7 +719,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
ics->predictor_reset_group = get_bits(gb, 5);
if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) {
av_log(ac->avctx, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n");
return -1;
return AVERROR_INVALIDDATA;
}
}
for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->m4ac.sampling_index]); sfb++) {
@@ -824,21 +829,22 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
int sect_band_type = get_bits(gb, 4);
if (sect_band_type == 12) {
av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
return -1;
return AVERROR_INVALIDDATA;
}
while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1 && get_bits_left(gb) >= bits)
do {
sect_len_incr = get_bits(gb, bits);
sect_end += sect_len_incr;
sect_end += sect_len_incr;
if (get_bits_left(gb) < 0 || sect_len_incr == (1 << bits) - 1) {
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
return -1;
}
if (sect_end > ics->max_sfb) {
av_log(ac->avctx, AV_LOG_ERROR,
"Number of bands (%d) exceeds limit (%d).\n",
sect_end, ics->max_sfb);
return -1;
}
if (get_bits_left(gb) < 0) {
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
return AVERROR_INVALIDDATA;
}
if (sect_end > ics->max_sfb) {
av_log(ac->avctx, AV_LOG_ERROR,
"Number of bands (%d) exceeds limit (%d).\n",
sect_end, ics->max_sfb);
return AVERROR_INVALIDDATA;
}
} while (sect_len_incr == (1 << bits) - 1);
for (; k < sect_end; k++) {
band_type [idx] = sect_band_type;
band_type_run_end[idx++] = sect_end;
@@ -908,7 +914,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"%s (%d) out of range.\n", sf_str[0], offset[0]);
return -1;
return AVERROR_INVALIDDATA;
}
sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];
}
@@ -966,7 +972,7 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
av_log(ac->avctx, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n",
tns->order[w][filt], tns_max_order);
tns->order[w][filt] = 0;
return -1;
return AVERROR_INVALIDDATA;
}
if (tns->order[w][filt]) {
tns->direction[w][filt] = get_bits1(gb);
@@ -1249,7 +1255,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
if (b > 8) {
av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
return -1;
return AVERROR_INVALIDDATA;
}
SKIP_BITS(re, gb, b + 1);
@@ -1392,6 +1398,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
IndividualChannelStream *ics = &sce->ics;
float *out = sce->coeffs;
int global_gain, pulse_present = 0;
int ret;
/* This assignment is to silence a GCC warning about the variable being used
* uninitialized when in fact it always is.
@@ -1405,25 +1412,27 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
return AVERROR_INVALIDDATA;
}
if (decode_band_types(ac, sce->band_type, sce->band_type_run_end, gb, ics) < 0)
return -1;
if (decode_scalefactors(ac, sce->sf, gb, global_gain, ics, sce->band_type, sce->band_type_run_end) < 0)
return -1;
if ((ret = decode_band_types(ac, sce->band_type,
sce->band_type_run_end, gb, ics)) < 0)
return ret;
if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics,
sce->band_type, sce->band_type_run_end)) < 0)
return ret;
pulse_present = 0;
if (!scale_flag) {
if ((pulse_present = get_bits1(gb))) {
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
av_log(ac->avctx, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
av_log(ac->avctx, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n");
return -1;
return AVERROR_INVALIDDATA;
}
}
if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
return -1;
return AVERROR_INVALIDDATA;
if (get_bits1(gb)) {
av_log_missing_feature(ac->avctx, "SSR", 1);
return -1;
@@ -1431,7 +1440,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
}
if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)
return -1;
return AVERROR_INVALIDDATA;
if (ac->m4ac.object_type == AOT_AAC_MAIN && !common_window)
apply_prediction(ac, sce);
@@ -1529,7 +1538,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
ms_present = get_bits(gb, 2);
if (ms_present == 3) {
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
return -1;
return AVERROR_INVALIDDATA;
} else if (ms_present)
decode_mid_side_stereo(cpe, gb, ms_present);
}
@@ -1765,7 +1774,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns,
int w, filt, m, i;
int bottom, top, order, start, end, size, inc;
float lpc[TNS_MAX_ORDER];
float tmp[TNS_MAX_ORDER];
float tmp[TNS_MAX_ORDER + 1];
for (w = 0; w < ics->num_windows; w++) {
bottom = ics->num_swb;
@@ -2267,7 +2276,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
if (samples) {
/* get output buffer */
ac->frame.nb_samples = samples;
if ((err = avctx->get_buffer(avctx, &ac->frame)) < 0) {
if ((err = ff_get_buffer(avctx, &ac->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return err;
}
@@ -2320,7 +2329,8 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
init_get_bits(&gb, buf, buf_size * 8);
if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0)
return err;
if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb)) < 0)
return err;
@@ -2565,7 +2575,8 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
int muxlength, err;
GetBitContext gb;
init_get_bits(&gb, avpkt->data, avpkt->size * 8);
if ((err = init_get_bits(&gb, avpkt->data, avpkt->size * 8)) < 0)
return err;
// check for LOAS sync word
if (get_bits(&gb, 11) != LOAS_SYNC_WORD)

View File

@@ -164,7 +164,7 @@ static void put_audio_specific_config(AVCodecContext *avctx)
PutBitContext pb;
AACEncContext *s = avctx->priv_data;
init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
put_bits(&pb, 5, 2); //object type - AAC-LC
put_bits(&pb, 4, s->samplerate_index); //sample rate index
put_bits(&pb, 4, s->channels);
@@ -200,8 +200,8 @@ WINDOW_FUNC(long_start)
float *out = sce->ret;
dsp->vector_fmul(out, audio, lwindow, 1024);
memcpy(out + 1024, audio, sizeof(out[0]) * 448);
dsp->vector_fmul_reverse(out + 1024 + 448, audio, swindow, 128);
memcpy(out + 1024, audio + 1024, sizeof(out[0]) * 448);
dsp->vector_fmul_reverse(out + 1024 + 448, audio + 1024 + 448, swindow, 128);
memset(out + 1024 + 576, 0, sizeof(out[0]) * 448);
}
@@ -487,10 +487,10 @@ static void deinterleave_input_samples(AACEncContext *s,
const float *sptr = samples + channel_map[ch];
/* copy last 1024 samples of previous frame to the start of the current frame */
memcpy(&s->planar_samples[ch][0], &s->planar_samples[ch][1024], 1024 * sizeof(s->planar_samples[0][0]));
memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0]));
/* deinterleave */
for (i = 1024; i < 1024 * 2; i++) {
for (i = 2048; i < 3072; i++) {
s->planar_samples[ch][i] = *sptr;
sptr += sinc;
}

View File

@@ -275,6 +275,10 @@ int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps
err:
ps->start = 0;
skip_bits_long(gb_host, bits_left);
memset(ps->iid_par, 0, sizeof(ps->iid_par));
memset(ps->icc_par, 0, sizeof(ps->icc_par));
memset(ps->ipd_par, 0, sizeof(ps->ipd_par));
memset(ps->opd_par, 0, sizeof(ps->opd_par));
return bits_left;
}

View File

@@ -542,7 +542,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
k = sbr->n_master;
} while (sb != sbr->kx[1] + sbr->m[1]);
if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1)
if (sbr->num_patches > 1 && sbr->patch_num_subbands[sbr->num_patches-1] < 3)
sbr->num_patches--;
return 0;

View File

@@ -34,17 +34,10 @@
typedef struct AascContext {
AVCodecContext *avctx;
GetByteContext gb;
AVFrame frame;
} AascContext;
#define FETCH_NEXT_STREAM_BYTE() \
if (stream_ptr >= buf_size) \
{ \
av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
break; \
} \
stream_byte = buf[stream_ptr++];
static av_cold int aasc_decode_init(AVCodecContext *avctx)
{
AascContext *s = avctx->priv_data;
@@ -89,7 +82,8 @@ static int aasc_decode_frame(AVCodecContext *avctx,
}
break;
case 1:
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, buf - 4, buf_size + 4);
bytestream2_init(&s->gb, buf - 4, buf_size + 4);
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);

View File

@@ -134,7 +134,7 @@ int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
(hdr->num_blocks * 256.0));
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
}
hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode];
if (hdr->lfe_on)
hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
@@ -147,7 +147,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int err;
union {
uint64_t u64;
uint8_t u8[8];
uint8_t u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
} tmp = { av_be2ne64(state) };
AC3HeaderInfo hdr;
GetBitContext gbc;

View File

@@ -297,7 +297,7 @@ static int parse_frame_header(AC3DecodeContext *s)
return ff_eac3_parse_header(s);
} else {
av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
return -1;
return AVERROR(ENOSYS);
}
}
@@ -822,12 +822,12 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (start_subband >= end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
"range (%d >= %d)\n", start_subband, end_subband);
return -1;
return AVERROR_INVALIDDATA;
}
if (dst_start_freq >= src_start_freq) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
"copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
return -1;
return AVERROR_INVALIDDATA;
}
s->spx_dst_start_freq = dst_start_freq;
@@ -904,7 +904,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (channel_mode < AC3_CHMODE_STEREO) {
av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n");
return -1;
return AVERROR_INVALIDDATA;
}
/* check for enhanced coupling */
@@ -934,7 +934,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (cpl_start_subband >= cpl_end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
cpl_start_subband, cpl_end_subband);
return -1;
return AVERROR_INVALIDDATA;
}
s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37;
s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37;
@@ -956,7 +956,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must "
"be present in block 0\n");
return -1;
return AVERROR_INVALIDDATA;
} else {
s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
}
@@ -986,7 +986,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must "
"be present in block 0\n");
return -1;
return AVERROR_INVALIDDATA;
}
} else {
/* channel not in coupling */
@@ -1041,7 +1041,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
int bandwidth_code = get_bits(gbc, 6);
if (bandwidth_code > 60) {
av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code);
return -1;
return AVERROR_INVALIDDATA;
}
s->end_freq[ch] = bandwidth_code * 3 + 73;
}
@@ -1064,7 +1064,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->num_exp_groups[ch], s->dexps[ch][0],
&s->dexps[ch][s->start_freq[ch]+!!ch])) {
av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (ch != CPL_CH && ch != s->lfe_ch)
skip_bits(gbc, 2); /* skip gainrng */
@@ -1084,7 +1084,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must "
"be present in block 0\n");
return -1;
return AVERROR_INVALIDDATA;
}
}
@@ -1115,7 +1115,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
}
} else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
return -1;
return AVERROR_INVALIDDATA;
}
}
@@ -1154,7 +1154,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must "
"be present in block 0\n");
return -1;
return AVERROR_INVALIDDATA;
}
s->first_cpl_leak = 0;
}
@@ -1166,7 +1166,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->dba_mode[ch] = get_bits(gbc, 2);
if (s->dba_mode[ch] == DBA_RESERVED) {
av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
return -1;
return AVERROR_INVALIDDATA;
}
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
}
@@ -1207,7 +1207,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->dba_offsets[ch], s->dba_lengths[ch],
s->dba_values[ch], s->mask[ch])) {
av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
return -1;
return AVERROR_INVALIDDATA;
}
}
if (bit_alloc_stages[ch] > 0) {
@@ -1328,7 +1328,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
switch (err) {
case AAC_AC3_PARSE_ERROR_SYNC:
av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
return -1;
return AVERROR_INVALIDDATA;
case AAC_AC3_PARSE_ERROR_BSID:
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
break;
@@ -1342,17 +1342,20 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
/* skip frame if CRC is ok. otherwise use error concealment. */
/* TODO: add support for substreams and dependent frames */
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
av_log(avctx, AV_LOG_ERROR, "unsupported frame type : "
av_log(avctx, AV_LOG_WARNING, "unsupported frame type : "
"skipping frame\n");
*got_frame_ptr = 0;
return s->frame_size;
return buf_size;
} else {
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
}
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid header\n");
case AAC_AC3_PARSE_ERROR_CRC:
case AAC_AC3_PARSE_ERROR_CHANNEL_CFG:
break;
default: // Normal AVERROR do not try to recover.
*got_frame_ptr = 0;
return err;
}
} else {
/* check that reported frame size fits in input buffer */
@@ -1373,8 +1376,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
if (!err) {
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
}
/* channel config */
/* channel config */
if (!err || (s->channels && s->out_channels != s->channels)) {
s->out_channels = s->channels;
s->output_mode = s->channel_mode;
if (s->lfe_on)
@@ -1383,7 +1388,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
avctx->request_channels < s->channels) {
s->out_channels = avctx->request_channels;
s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
s->channel_layout = ff_ac3_channel_layout_tab[s->output_mode];
s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode];
}
avctx->channels = s->out_channels;
avctx->channel_layout = s->channel_layout;
@@ -1397,11 +1402,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
} else if (!s->out_channels) {
s->out_channels = avctx->channels;
if (s->out_channels < s->channels)
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
} else if (!s->channels) {
av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
return AVERROR_INVALIDDATA;
}
avctx->channels = s->out_channels;
/* set audio service type based on bitstream mode for AC-3 */
avctx->audio_service_type = s->bitstream_mode;
if (s->bitstream_mode == 0x7 && s->channels > 1)
@@ -1409,7 +1415,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
s->frame.nb_samples = s->num_blocks * 256;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -109,7 +109,7 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
int snr_offset, int floor,
const uint8_t *bap_tab, uint8_t *bap)
{
int bin, band;
int bin, band, band_end;
/* special case, if snr offset is -960, set all bap's to zero */
if (snr_offset == -960) {
@@ -121,12 +121,14 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
band = ff_ac3_bin_to_band_tab[start];
do {
int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
band_end = ff_ac3_band_start_tab[++band];
band_end = FFMIN(band_end, end);
for (; bin < band_end; bin++) {
int address = av_clip((psd[bin] - m) >> 5, 0, 63);
bap[bin] = bap_tab[address];
}
} while (end > ff_ac3_band_start_tab[band++]);
} while (end > band_end);
}
static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,

View File

@@ -261,7 +261,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
energy_cpl = energy[blk][CPL_CH][bnd];
energy_ch = energy[blk][ch][bnd];
blk1 = blk+1;
while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) {
while (blk1 < s->num_blocks && !s->blocks[blk1].new_cpl_coords[ch]) {
if (s->blocks[blk1].cpl_in_use) {
energy_cpl += energy[blk1][CPL_CH][bnd];
energy_ch += energy[blk1][ch][bnd];

View File

@@ -84,7 +84,7 @@ const uint8_t ff_ac3_channels_tab[8] = {
/**
* Map audio coding mode (acmod) to channel layout mask.
*/
const uint16_t ff_ac3_channel_layout_tab[8] = {
const uint16_t avpriv_ac3_channel_layout_tab[8] = {
AV_CH_LAYOUT_STEREO,
AV_CH_LAYOUT_MONO,
AV_CH_LAYOUT_STEREO,

View File

@@ -33,7 +33,7 @@
extern const uint16_t ff_ac3_frame_size_tab[38][3];
extern const uint8_t ff_ac3_channels_tab[8];
extern const uint16_t ff_ac3_channel_layout_tab[8];
extern const uint16_t avpriv_ac3_channel_layout_tab[8];
extern const uint8_t ff_ac3_enc_channel_map[8][2][6];
extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
extern const uint16_t ff_ac3_sample_rate_tab[3];

View File

@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
#include "bytestream.h"
@@ -265,8 +266,9 @@ static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned c
return c->predictor;
}
static void xa_decode(short *out, const unsigned char *in,
ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
static int xa_decode(AVCodecContext *avctx,
short *out, const unsigned char *in,
ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
{
int i, j;
int shift,filter,f0,f1;
@@ -277,6 +279,12 @@ static void xa_decode(short *out, const unsigned char *in,
shift = 12 - (in[4+i*2] & 15);
filter = in[4+i*2] >> 4;
if (filter > 4) {
av_log(avctx, AV_LOG_ERROR,
"Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
filter);
return AVERROR_INVALIDDATA;
}
f0 = xa_adpcm_table[filter][0];
f1 = xa_adpcm_table[filter][1];
@@ -304,7 +312,12 @@ static void xa_decode(short *out, const unsigned char *in,
shift = 12 - (in[5+i*2] & 15);
filter = in[5+i*2] >> 4;
if (filter > 4) {
av_log(avctx, AV_LOG_ERROR,
"Invalid XA-ADPCM filter %d (max. allowed is 4)\n",
filter);
return AVERROR_INVALIDDATA;
}
f0 = xa_adpcm_table[filter][0];
f1 = xa_adpcm_table[filter][1];
@@ -328,6 +341,8 @@ static void xa_decode(short *out, const unsigned char *in,
left->sample2 = s_2;
}
}
return 0;
}
/**
@@ -542,7 +557,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = nb_samples;
if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -699,11 +714,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
cs->predictor = (int16_t)bytestream_get_le16(&src);
cs->step_index = *src++;
cs->step_index = av_clip(*src++, 0, 88);
src++;
*samples++ = cs->predictor;
}
for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
for (n = (nb_samples >> (1 - st)) - 1; n > 0; n--, src++) {
uint8_t v = *src;
*samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
@@ -722,8 +737,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
c->status[0].predictor = (int16_t)AV_RL16(src + 10);
c->status[1].predictor = (int16_t)AV_RL16(src + 12);
c->status[0].step_index = src[14];
c->status[1].step_index = src[15];
c->status[0].step_index = av_clip(src[14], 0, 88);
c->status[1].step_index = av_clip(src[15], 0, 88);
/* sign extend the predictors */
src += 16;
diff_channel = c->status[1].predictor;
@@ -763,7 +778,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
cs->predictor = (int16_t)bytestream_get_le16(&src);
cs->step_index = *src++;
cs->step_index = av_clip(*src++, 0, 88);
src++;
}
@@ -815,8 +830,9 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
break;
case CODEC_ID_ADPCM_XA:
while (buf_size >= 128) {
xa_decode(samples, src, &c->status[0], &c->status[1],
avctx->channels);
if ((ret = xa_decode(avctx, samples, src, &c->status[0],
&c->status[1], avctx->channels)) < 0)
return ret;
src += 128;
samples += 28 * 8;
buf_size -= 128;
@@ -826,7 +842,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
src += 4; // skip sample count (already read)
for (i=0; i<=st; i++)
c->status[i].step_index = bytestream_get_le32(&src);
c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88);
for (i=0; i<=st; i++)
c->status[i].predictor = bytestream_get_le32(&src);
@@ -1043,11 +1059,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
case CODEC_ID_ADPCM_IMA_SMJPEG:
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) {
c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16);
c->status[0].step_index = bytestream_get_le16(&src);
c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88);
src += 4;
} else {
c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16);
c->status[0].step_index = bytestream_get_byte(&src);
c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88);
src += 1;
}

View File

@@ -551,10 +551,10 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
{
int ch, i;
PutBitContext pb;
init_put_bits(&pb, dst, buf_size * 8);
init_put_bits(&pb, dst, buf_size);
for (ch = 0; ch < avctx->channels; ch++) {
put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
put_bits(&pb, 9, (c->status[ch].prev_sample & 0xFFFF) >> 7);
put_bits(&pb, 7, c->status[ch].step_index);
if (avctx->trellis > 0) {
uint8_t buf[64];
@@ -582,7 +582,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
{
int i;
PutBitContext pb;
init_put_bits(&pb, dst, buf_size * 8);
init_put_bits(&pb, dst, buf_size);
n = avctx->frame_size - 1;

View File

@@ -47,7 +47,7 @@ int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
offset = AV_RB16(buf + 2) + 4;
/* if copyright string is within the provided data, validate it */
if (bufsize >= offset && memcmp(buf + offset - 6, "(c)CRI", 6))
if (bufsize >= offset && offset >= 6 && memcmp(buf + offset - 6, "(c)CRI", 6))
return AVERROR_INVALIDDATA;
/* check for encoding=3 block_size=18, sample_size=4 */

View File

@@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
#include "adx.h"
#include "get_bits.h"
@@ -140,7 +141,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = num_blocks * BLOCK_SAMPLES;
if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -47,6 +47,7 @@
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "bytestream.h"
#include "unary.h"
@@ -417,7 +418,7 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
alac->frame.nb_samples = outputsamples;
if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &alac->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -615,6 +616,12 @@ static int alac_set_info(ALACContext *alac)
/* buffer size / 2 ? */
alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr);
if (!alac->setinfo_max_samples_per_frame ||
alac->setinfo_max_samples_per_frame > INT_MAX / sizeof(int32_t)) {
av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n",
alac->setinfo_max_samples_per_frame);
return AVERROR_INVALIDDATA;
}
ptr++; /* compatible version */
alac->setinfo_sample_size = *ptr++;
alac->setinfo_rice_historymult = *ptr++;
@@ -636,10 +643,9 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
alac->avctx = avctx;
/* initialize from the extradata */
if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
ALAC_EXTRADATA_SIZE);
return -1;
if (alac->avctx->extradata_size < ALAC_EXTRADATA_SIZE) {
av_log(avctx, AV_LOG_ERROR, "alac: extradata is too small\n");
return AVERROR_INVALIDDATA;
}
if (alac_set_info(alac)) {
av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");

View File

@@ -259,7 +259,7 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
// generate warm-up samples
residual[0] = samples[0];
for (i = 1; i <= lpc.lpc_order; i++)
residual[i] = samples[i] - samples[i-1];
residual[i] = sign_extend(samples[i] - samples[i-1], s->write_sample_size);
// perform lpc on remaining samples
for (i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) {

View File

@@ -30,6 +30,7 @@
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "unary.h"
#include "mpeg4audio.h"
@@ -283,7 +284,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
GetBitContext gb;
uint64_t ht_size;
int i, config_offset;
MPEG4AudioConfig m4ac;
MPEG4AudioConfig m4ac = {0};
ALSSpecificConfig *sconf = &ctx->sconf;
AVCodecContext *avctx = ctx->avctx;
uint32_t als_id, header_size, trailer_size;
@@ -294,12 +295,12 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
avctx->extradata_size * 8, 1);
if (config_offset < 0)
return -1;
return AVERROR_INVALIDDATA;
skip_bits_long(&gb, config_offset);
if (get_bits_left(&gb) < (30 << 3))
return -1;
return AVERROR_INVALIDDATA;
// read the fixed items
als_id = get_bits_long(&gb, 32);
@@ -334,7 +335,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
// check for ALSSpecificConfig struct
if (als_id != MKBETAG('A','L','S','\0'))
return -1;
return AVERROR_INVALIDDATA;
ctx->cur_frame_length = sconf->frame_length;
@@ -349,7 +350,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
int chan_pos_bits = av_ceil_log2(avctx->channels);
int bits_needed = avctx->channels * chan_pos_bits + 7;
if (get_bits_left(&gb) < bits_needed)
return -1;
return AVERROR_INVALIDDATA;
if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos))))
return AVERROR(ENOMEM);
@@ -367,7 +368,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
// read fixed header and trailer sizes,
// if size = 0xFFFFFFFF then there is no data field!
if (get_bits_left(&gb) < 64)
return -1;
return AVERROR_INVALIDDATA;
header_size = get_bits_long(&gb, 32);
trailer_size = get_bits_long(&gb, 32);
@@ -381,10 +382,10 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
// skip the header and trailer data
if (get_bits_left(&gb) < ht_size)
return -1;
return AVERROR_INVALIDDATA;
if (ht_size > INT32_MAX)
return -1;
return AVERROR_PATCHWELCOME;
skip_bits_long(&gb, ht_size);
@@ -392,7 +393,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
// initialize CRC calculation
if (sconf->crc_enabled) {
if (get_bits_left(&gb) < 32)
return -1;
return AVERROR_INVALIDDATA;
if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {
ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
@@ -632,7 +633,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
if (bd->block_length & (sub_blocks - 1)) {
av_log(avctx, AV_LOG_WARNING,
"Block length is not evenly divisible by the number of subblocks.\n");
return -1;
return AVERROR_INVALIDDATA;
}
sb_length = bd->block_length >> log2_sub_blocks;
@@ -651,6 +652,11 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
for (k = 1; k < sub_blocks; k++)
s[k] = s[k - 1] + decode_rice(gb, 0);
}
for (k = 1; k < sub_blocks; k++)
if (s[k] > 32) {
av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n");
return AVERROR_INVALIDDATA;
}
if (get_bits1(gb))
*bd->shift_lsbs = get_bits(gb, 4) + 1;
@@ -663,6 +669,11 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
2, sconf->max_order + 1));
*bd->opt_order = get_bits(gb, opt_order_length);
if (*bd->opt_order > sconf->max_order) {
*bd->opt_order = sconf->max_order;
av_log(avctx, AV_LOG_ERROR, "Predictor order too large!\n");
return AVERROR_INVALIDDATA;
}
} else {
*bd->opt_order = sconf->max_order;
}
@@ -695,6 +706,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
int rice_param = parcor_rice_table[sconf->coef_table][k][1];
int offset = parcor_rice_table[sconf->coef_table][k][0];
quant_cof[k] = decode_rice(gb, rice_param) + offset;
if (quant_cof[k] < -64 || quant_cof[k] > 63) {
av_log(avctx, AV_LOG_ERROR, "quant_cof %d is out of range\n", quant_cof[k]);
return AVERROR_INVALIDDATA;
}
}
// read coefficients 20 to 126
@@ -727,7 +742,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
bd->ltp_gain[0] = decode_rice(gb, 1) << 3;
bd->ltp_gain[1] = decode_rice(gb, 2) << 3;
r = get_unary(gb, 0, 4);
r = get_unary(gb, 0, 3);
c = get_bits(gb, 2);
bd->ltp_gain[2] = ltp_gain_values[r][c];
@@ -756,7 +771,6 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
int delta[8];
unsigned int k [8];
unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5);
unsigned int i = start;
// read most significant bits
unsigned int high;
@@ -767,29 +781,30 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
current_res = bd->raw_samples + start;
for (sb = 0; sb < sub_blocks; sb++, i = 0) {
for (sb = 0; sb < sub_blocks; sb++) {
unsigned int sb_len = sb_length - (sb ? 0 : start);
k [sb] = s[sb] > b ? s[sb] - b : 0;
delta[sb] = 5 - s[sb] + k[sb];
ff_bgmc_decode(gb, sb_length, current_res,
ff_bgmc_decode(gb, sb_len, current_res,
delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status);
current_res += sb_length;
current_res += sb_len;
}
ff_bgmc_decode_end(gb);
// read least significant bits and tails
i = start;
current_res = bd->raw_samples + start;
for (sb = 0; sb < sub_blocks; sb++, i = 0) {
for (sb = 0; sb < sub_blocks; sb++, start = 0) {
unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]];
unsigned int cur_k = k[sb];
unsigned int cur_s = s[sb];
for (; i < sb_length; i++) {
for (; start < sb_length; start++) {
int32_t res = *current_res;
if (res == cur_tail_code) {
@@ -949,18 +964,18 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
*/
static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
{
int ret = 0;
GetBitContext *gb = &ctx->gb;
*bd->shift_lsbs = 0;
// read block type flag and read the samples accordingly
if (get_bits1(gb)) {
if (read_var_block_data(ctx, bd))
return -1;
ret = read_var_block_data(ctx, bd);
} else {
read_const_block_data(ctx, bd);
}
return 0;
return ret;
}
@@ -969,12 +984,16 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
{
unsigned int smp;
int ret = 0;
// read block type flag and read the samples accordingly
if (*bd->const_block)
decode_const_block_data(ctx, bd);
else if (decode_var_block_data(ctx, bd))
return -1;
else
ret = decode_var_block_data(ctx, bd); // always return 0
if (ret < 0)
return ret;
// TODO: read RLSLMS extension data
@@ -992,14 +1011,10 @@ static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)
{
int ret;
ret = read_block(ctx, bd);
if (ret)
if ((ret = read_block(ctx, bd)) < 0)
return ret;
ret = decode_block(ctx, bd);
return ret;
return decode_block(ctx, bd);
}
@@ -1025,6 +1040,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int c, const unsigned int *div_blocks,
unsigned int *js_blocks)
{
int ret;
unsigned int b;
ALSBlockData bd;
@@ -1047,10 +1063,10 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
for (b = 0; b < ctx->num_blocks; b++) {
bd.block_length = div_blocks[b];
if (read_decode_block(ctx, &bd)) {
if ((ret = read_decode_block(ctx, &bd)) < 0) {
// damaged block, write zero for the rest of the frame
zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);
return -1;
return ret;
}
bd.raw_samples += div_blocks[b];
bd.ra_block = 0;
@@ -1069,6 +1085,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
ALSSpecificConfig *sconf = &ctx->sconf;
unsigned int offset = 0;
unsigned int b;
int ret;
ALSBlockData bd[2];
memset(bd, 0, 2 * sizeof(ALSBlockData));
@@ -1112,12 +1129,10 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
bd[0].raw_other = bd[1].raw_samples;
bd[1].raw_other = bd[0].raw_samples;
if(read_decode_block(ctx, &bd[0]) || read_decode_block(ctx, &bd[1])) {
// damaged block, write zero for the rest of the frame
zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples);
zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples);
return -1;
}
if ((ret = read_decode_block(ctx, &bd[0])) < 0 ||
(ret = read_decode_block(ctx, &bd[1])) < 0)
goto fail;
// reconstruct joint-stereo blocks
if (bd[0].js_blocks) {
@@ -1143,8 +1158,19 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
sizeof(*ctx->raw_samples[c]) * sconf->max_order);
return 0;
fail:
// damaged block, write zero for the rest of the frame
zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples);
zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples);
return ret;
}
static inline int als_weighting(GetBitContext *gb, int k, int off)
{
int idx = av_clip(decode_rice(gb, k) + off,
0, FF_ARRAY_ELEMS(mcc_weightings) - 1);
return mcc_weightings[idx];
}
/** Read the channel data.
*/
@@ -1160,19 +1186,19 @@ static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
if (current->master_channel >= channels) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (current->master_channel != c) {
current->time_diff_flag = get_bits1(gb);
current->weighting[0] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
current->weighting[1] = mcc_weightings[av_clip(decode_rice(gb, 2) + 14, 0, 32)];
current->weighting[2] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
current->weighting[0] = als_weighting(gb, 1, 16);
current->weighting[1] = als_weighting(gb, 2, 14);
current->weighting[2] = als_weighting(gb, 1, 16);
if (current->time_diff_flag) {
current->weighting[3] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
current->weighting[4] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
current->weighting[5] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
current->weighting[3] = als_weighting(gb, 1, 16);
current->weighting[4] = als_weighting(gb, 1, 16);
current->weighting[5] = als_weighting(gb, 1, 16);
current->time_diff_sign = get_bits1(gb);
current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
@@ -1185,7 +1211,7 @@ static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
if (entries == channels) {
av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n");
return -1;
return AVERROR_INVALIDDATA;
}
align_get_bits(gb);
@@ -1217,7 +1243,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
if (dep == channels) {
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation!\n");
return -1;
return AVERROR_INVALIDDATA;
}
bd->const_block = ctx->const_block + c;
@@ -1290,6 +1316,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
unsigned int js_blocks[2];
uint32_t bs_info = 0;
int ret;
// skip the size of the ra unit if present in the frame
if (sconf->ra_flag == RA_FLAG_FRAMES && ra_frame)
@@ -1320,13 +1347,15 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
independent_bs = 1;
if (independent_bs) {
if (decode_blocks_ind(ctx, ra_frame, c, div_blocks, js_blocks))
return -1;
ret = decode_blocks_ind(ctx, ra_frame, c,
div_blocks, js_blocks);
if (ret < 0)
return ret;
independent_bs--;
} else {
if (decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks))
return -1;
ret = decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks);
if (ret < 0)
return ret;
c++;
}
@@ -1345,7 +1374,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
for (c = 0; c < avctx->channels; c++)
if (ctx->chan_data[c] < ctx->chan_data_buffer) {
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data!\n");
return -1;
return AVERROR_INVALIDDATA;
}
memset(&bd, 0, sizeof(ALSBlockData));
@@ -1358,6 +1387,11 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
for (b = 0; b < ctx->num_blocks; b++) {
bd.block_length = div_blocks[b];
if (bd.block_length <= 0) {
av_log(ctx->avctx, AV_LOG_WARNING,
"Invalid block length %d in channel data!\n", bd.block_length);
continue;
}
for (c = 0; c < avctx->channels; c++) {
bd.const_block = ctx->const_block + c;
@@ -1377,11 +1411,12 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
return -1;
}
for (c = 0; c < avctx->channels; c++)
if (revert_channel_correlation(ctx, &bd, ctx->chan_data,
reverted_channels, offset, c))
return -1;
for (c = 0; c < avctx->channels; c++) {
ret = revert_channel_correlation(ctx, &bd, ctx->chan_data,
reverted_channels, offset, c);
if (ret < 0)
return ret;
}
for (c = 0; c < avctx->channels; c++) {
bd.const_block = ctx->const_block + c;
bd.shift_lsbs = ctx->shift_lsbs + c;
@@ -1450,7 +1485,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
/* get output buffer */
ctx->frame.nb_samples = ctx->cur_frame_length;
if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -1578,29 +1613,30 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
unsigned int c;
unsigned int channel_size;
int num_buffers;
int num_buffers, ret;
ALSDecContext *ctx = avctx->priv_data;
ALSSpecificConfig *sconf = &ctx->sconf;
ctx->avctx = avctx;
if (!avctx->extradata) {
av_log(avctx, AV_LOG_ERROR, "Missing required ALS extradata.\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (read_specific_config(ctx)) {
if ((ret = read_specific_config(ctx)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Reading ALSSpecificConfig failed.\n");
decode_end(avctx);
return -1;
goto fail;
}
if (check_specific_config(ctx)) {
decode_end(avctx);
return -1;
if ((ret = check_specific_config(ctx)) < 0) {
goto fail;
}
if (sconf->bgmc)
ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
if (sconf->bgmc) {
ret = ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
if (ret < 0)
goto fail;
}
if (sconf->floating) {
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
@@ -1636,7 +1672,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
!ctx->quant_cof_buffer || !ctx->lpc_cof_buffer ||
!ctx->lpc_cof_reversed_buffer) {
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
// assign quantized parcor coefficient buffers
@@ -1661,8 +1698,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
!ctx->use_ltp || !ctx->ltp_lag ||
!ctx->ltp_gain || !ctx->ltp_gain_buffer) {
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
decode_end(avctx);
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
for (c = 0; c < num_buffers; c++)
@@ -1679,8 +1716,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (!ctx->chan_data_buffer || !ctx->chan_data || !ctx->reverted_channels) {
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
decode_end(avctx);
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
for (c = 0; c < num_buffers; c++)
@@ -1701,8 +1738,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
// allocate previous raw sample buffer
if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
decode_end(avctx);
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
// assign raw samples buffers
@@ -1719,8 +1756,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_get_bytes_per_sample(avctx->sample_fmt));
if (!ctx->crc_buffer) {
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
decode_end(avctx);
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
}
@@ -1730,6 +1767,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->coded_frame = &ctx->frame;
return 0;
fail:
decode_end(avctx);
return ret;
}

View File

@@ -44,6 +44,7 @@
#include <math.h>
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "libavutil/common.h"
#include "celp_math.h"
@@ -200,6 +201,10 @@ static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
p->bad_frame_indicator = !get_bits1(&gb); // quality bit
skip_bits(&gb, 2); // two padding bits
if (mode >= N_MODES || buf_size < frame_sizes_nb[mode] + 1) {
return NO_DATA;
}
if (mode < MODE_DTX)
ff_amr_bit_reorder((uint16_t *) &p->frame, sizeof(AMRNBFrame), buf + 1,
amr_unpacking_bitmaps_per_mode[mode]);
@@ -940,13 +945,17 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
p->avframe.nb_samples = AMR_BLOCK_SIZE;
if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) {
if ((ret = ff_get_buffer(avctx, &p->avframe)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
buf_out = (float *)p->avframe.data[0];
p->cur_frame_mode = unpack_bitstream(p, buf, buf_size);
if (p->cur_frame_mode == NO_DATA) {
av_log(avctx, AV_LOG_ERROR, "Corrupt bitstream\n");
return AVERROR_INVALIDDATA;
}
if (p->cur_frame_mode == MODE_DTX) {
av_log_missing_feature(avctx, "dtx mode", 0);
av_log(avctx, AV_LOG_INFO, "Note: libopencore_amrnb supports dtx\n");

View File

@@ -27,6 +27,7 @@
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "lsp.h"
#include "celp_math.h"
@@ -898,10 +899,10 @@ static float auto_correlation(float *diff_isf, float mean, int lag)
* Extrapolate a ISF vector to the 16kHz range (20th order LP)
* used at mode 6k60 LP filter for the high frequency band.
*
* @param[out] out Buffer for extrapolated isf
* @param[in] isf Input isf vector
* @param[out] isf Buffer for extrapolated isf; contains LP_ORDER
* values on input
*/
static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER])
static void extrapolate_isf(float isf[LP_ORDER_16k])
{
float diff_isf[LP_ORDER - 2], diff_mean;
float *diff_hi = diff_isf - LP_ORDER + 1; // diff array for extrapolated indexes
@@ -909,8 +910,7 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER])
float est, scale;
int i, i_max_corr;
memcpy(out, isf, (LP_ORDER - 1) * sizeof(float));
out[LP_ORDER_16k - 1] = isf[LP_ORDER - 1];
isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1];
/* Calculate the difference vector */
for (i = 0; i < LP_ORDER - 2; i++)
@@ -931,16 +931,16 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER])
i_max_corr++;
for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)
out[i] = isf[i - 1] + isf[i - 1 - i_max_corr]
isf[i] = isf[i - 1] + isf[i - 1 - i_max_corr]
- isf[i - 2 - i_max_corr];
/* Calculate an estimate for ISF(18) and scale ISF based on the error */
est = 7965 + (out[2] - out[3] - out[4]) / 6.0;
scale = 0.5 * (FFMIN(est, 7600) - out[LP_ORDER - 2]) /
(out[LP_ORDER_16k - 2] - out[LP_ORDER - 2]);
est = 7965 + (isf[2] - isf[3] - isf[4]) / 6.0;
scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) /
(isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]);
for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)
diff_hi[i] = scale * (out[i] - out[i - 1]);
diff_hi[i] = scale * (isf[i] - isf[i - 1]);
/* Stability insurance */
for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++)
@@ -952,11 +952,11 @@ static void extrapolate_isf(float out[LP_ORDER_16k], float isf[LP_ORDER])
}
for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)
out[i] = out[i - 1] + diff_hi[i] * (1.0f / (1 << 15));
isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15));
/* Scale the ISF vector for 16000 Hz */
for (i = 0; i < LP_ORDER_16k - 1; i++)
out[i] *= 0.8;
isf[i] *= 0.8;
}
/**
@@ -1003,7 +1003,7 @@ static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples,
ff_weighted_vector_sumf(e_isf, isf_past, isf, isfp_inter[subframe],
1.0 - isfp_inter[subframe], LP_ORDER);
extrapolate_isf(e_isf, e_isf);
extrapolate_isf(e_isf);
e_isf[LP_ORDER_16k - 1] *= 2.0;
ff_acelp_lsf2lspd(e_isp, e_isf, LP_ORDER_16k);
@@ -1088,30 +1088,34 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
ctx->avframe.nb_samples = 4 * AMRWB_SFR_SIZE_16k;
if ((ret = avctx->get_buffer(avctx, &ctx->avframe)) < 0) {
if ((ret = ff_get_buffer(avctx, &ctx->avframe)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
buf_out = (float *)ctx->avframe.data[0];
header_size = decode_mime_header(ctx, buf);
if (ctx->fr_cur_mode > MODE_SID) {
av_log(avctx, AV_LOG_ERROR,
"Invalid mode %d\n", ctx->fr_cur_mode);
return AVERROR_INVALIDDATA;
}
expected_fr_size = ((cf_sizes_wb[ctx->fr_cur_mode] + 7) >> 3) + 1;
if (buf_size < expected_fr_size) {
av_log(avctx, AV_LOG_ERROR,
"Frame too small (%d bytes). Truncated file?\n", buf_size);
*got_frame_ptr = 0;
return buf_size;
return AVERROR_INVALIDDATA;
}
if (!ctx->fr_quality || ctx->fr_cur_mode > MODE_SID)
av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n");
if (ctx->fr_cur_mode == MODE_SID) /* Comfort noise frame */
if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
av_log_missing_feature(avctx, "SID mode", 1);
if (ctx->fr_cur_mode >= MODE_SID)
return -1;
}
ff_amr_bit_reorder((uint16_t *) &ctx->frame, sizeof(AMRWBFrame),
buf + header_size, amr_bit_orderings_by_mode[ctx->fr_cur_mode]);

View File

@@ -26,6 +26,7 @@
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "internal.h"
#include "cga_data.h"
#define ATTR_BOLD 0x01 /**< Bold/Bright-foreground (mode 1) */
@@ -222,7 +223,7 @@ static int execute_code(AVCodecContext * avctx, int c)
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
avcodec_set_dimensions(avctx, width, height);
ret = avctx->get_buffer(avctx, &s->frame);
ret = ff_get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;

View File

@@ -22,6 +22,7 @@
#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "internal.h"
#include "dsputil.h"
#include "get_bits.h"
#include "bytestream.h"
@@ -404,9 +405,12 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
if (tmpk <= 16)
x = range_decode_bits(ctx, tmpk);
else {
else if (tmpk <= 32) {
x = range_decode_bits(ctx, 16);
x |= (range_decode_bits(ctx, tmpk - 16) << 16);
} else {
av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);
return AVERROR_INVALIDDATA;
}
x += overflow << tmpk;
} else {
@@ -819,7 +823,6 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
int16_t *samples;
int i, ret;
int blockstodecode;
int bytes_used = 0;
/* this should never be negative, but bad things will happen if it is, so
check it just to make sure. */
@@ -874,7 +877,6 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
bytes_used = buf_size;
}
if (!s->data) {
@@ -886,7 +888,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = blockstodecode;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -917,7 +919,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
return bytes_used;
return (s->samples == 0) ? buf_size : 0;
}
static void ape_flush(AVCodecContext *avctx)

View File

@@ -132,6 +132,13 @@ T ldr \rt, [\rn]
T add \rn, \rn, \rm
.endm
.macro ldrc_pre cc, rt, rn, rm:vararg
A ldr\cc \rt, [\rn, \rm]!
T itt \cc
T add\cc \rn, \rn, \rm
T ldr\cc \rt, [\rn]
.endm
.macro ldrd_reg rt, rt2, rn, rm
A ldrd \rt, \rt2, [\rn, \rm]
T add \rt, \rn, \rm

View File

@@ -146,10 +146,11 @@ function ff_put_pixels8_y2_armv6, export=1
eor r7, r5, r7
uadd8 r10, r10, r6
and r7, r7, r12
ldr_pre r6, r1, r2
ldrc_pre ne, r6, r1, r2
uadd8 r11, r11, r7
strd_post r8, r9, r0, r2
ldr r7, [r1, #4]
it ne
ldrne r7, [r1, #4]
strd_post r10, r11, r0, r2
bne 1b
@@ -198,9 +199,10 @@ function ff_put_pixels8_y2_no_rnd_armv6, export=1
uhadd8 r9, r5, r7
ldr r5, [r1, #4]
uhadd8 r12, r4, r6
ldr_pre r6, r1, r2
ldrc_pre ne, r6, r1, r2
uhadd8 r14, r5, r7
ldr r7, [r1, #4]
it ne
ldrne r7, [r1, #4]
stm r0, {r8,r9}
add r0, r0, r2
stm r0, {r12,r14}

View File

@@ -44,22 +44,22 @@ endfunc
.if \avg
mov r12, r0
.endif
1: vld1.64 {q0}, [r1], r2
vld1.64 {q1}, [r1], r2
vld1.64 {q2}, [r1], r2
1: vld1.8 {q0}, [r1], r2
vld1.8 {q1}, [r1], r2
vld1.8 {q2}, [r1], r2
pld [r1, r2, lsl #2]
vld1.64 {q3}, [r1], r2
vld1.8 {q3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
.if \avg
vld1.64 {q8}, [r12,:128], r2
vld1.8 {q8}, [r12,:128], r2
vrhadd.u8 q0, q0, q8
vld1.64 {q9}, [r12,:128], r2
vld1.8 {q9}, [r12,:128], r2
vrhadd.u8 q1, q1, q9
vld1.64 {q10}, [r12,:128], r2
vld1.8 {q10}, [r12,:128], r2
vrhadd.u8 q2, q2, q10
vld1.64 {q11}, [r12,:128], r2
vld1.8 {q11}, [r12,:128], r2
vrhadd.u8 q3, q3, q11
.endif
subs r3, r3, #4
@@ -72,8 +72,8 @@ endfunc
.endm
.macro pixels16_x2 rnd=1, avg=0
1: vld1.64 {d0-d2}, [r1], r2
vld1.64 {d4-d6}, [r1], r2
1: vld1.8 {d0-d2}, [r1], r2
vld1.8 {d4-d6}, [r1], r2
pld [r1]
pld [r1, r2]
subs r3, r3, #2
@@ -88,20 +88,21 @@ endfunc
vrhadd.u8 q2, q2, q3
sub r0, r0, r2
.endif
vst1.64 {q0}, [r0,:128], r2
vst1.64 {q2}, [r0,:128], r2
vst1.8 {q0}, [r0,:128], r2
vst1.8 {q2}, [r0,:128], r2
bne 1b
bx lr
.endm
.macro pixels16_y2 rnd=1, avg=0
vld1.64 {q0}, [r1], r2
vld1.64 {q1}, [r1], r2
sub r3, r3, #2
vld1.8 {q0}, [r1], r2
vld1.8 {q1}, [r1], r2
1: subs r3, r3, #2
avg q2, q0, q1
vld1.64 {q0}, [r1], r2
vld1.8 {q0}, [r1], r2
avg q3, q0, q1
vld1.64 {q1}, [r1], r2
vld1.8 {q1}, [r1], r2
pld [r1]
pld [r1, r2]
.if \avg
@@ -111,18 +112,31 @@ endfunc
vrhadd.u8 q3, q3, q9
sub r0, r0, r2
.endif
vst1.64 {q2}, [r0,:128], r2
vst1.64 {q3}, [r0,:128], r2
vst1.8 {q2}, [r0,:128], r2
vst1.8 {q3}, [r0,:128], r2
bne 1b
avg q2, q0, q1
vld1.8 {q0}, [r1], r2
avg q3, q0, q1
.if \avg
vld1.8 {q8}, [r0,:128], r2
vld1.8 {q9}, [r0,:128]
vrhadd.u8 q2, q2, q8
vrhadd.u8 q3, q3, q9
sub r0, r0, r2
.endif
vst1.8 {q2}, [r0,:128], r2
vst1.8 {q3}, [r0,:128], r2
bx lr
.endm
.macro pixels16_xy2 rnd=1, avg=0
vld1.64 {d0-d2}, [r1], r2
vld1.64 {d4-d6}, [r1], r2
.ifeq \rnd
vmov.i16 q13, #1
.endif
sub r3, r3, #2
vld1.8 {d0-d2}, [r1], r2
vld1.8 {d4-d6}, [r1], r2
NRND vmov.i16 q13, #1
pld [r1]
pld [r1, r2]
vext.8 q1, q0, q1, #1
@@ -132,38 +146,30 @@ endfunc
vaddl.u8 q9, d4, d6
vaddl.u8 q11, d5, d7
1: subs r3, r3, #2
vld1.64 {d0-d2}, [r1], r2
vld1.8 {d0-d2}, [r1], r2
vadd.u16 q12, q8, q9
pld [r1]
.ifeq \rnd
vadd.u16 q12, q12, q13
.endif
NRND vadd.u16 q12, q12, q13
vext.8 q15, q0, q1, #1
vadd.u16 q1 , q10, q11
shrn d28, q12, #2
.ifeq \rnd
vadd.u16 q1, q1, q13
.endif
NRND vadd.u16 q1, q1, q13
shrn d29, q1, #2
.if \avg
vld1.8 {q8}, [r0,:128]
vrhadd.u8 q14, q14, q8
.endif
vaddl.u8 q8, d0, d30
vld1.64 {d2-d4}, [r1], r2
vld1.8 {d2-d4}, [r1], r2
vaddl.u8 q10, d1, d31
vst1.64 {q14}, [r0,:128], r2
vst1.8 {q14}, [r0,:128], r2
vadd.u16 q12, q8, q9
pld [r1, r2]
.ifeq \rnd
vadd.u16 q12, q12, q13
.endif
NRND vadd.u16 q12, q12, q13
vext.8 q2, q1, q2, #1
vadd.u16 q0, q10, q11
shrn d30, q12, #2
.ifeq \rnd
vadd.u16 q0, q0, q13
.endif
NRND vadd.u16 q0, q0, q13
shrn d31, q0, #2
.if \avg
vld1.8 {q9}, [r0,:128]
@@ -171,44 +177,72 @@ endfunc
.endif
vaddl.u8 q9, d2, d4
vaddl.u8 q11, d3, d5
vst1.64 {q15}, [r0,:128], r2
vst1.8 {q15}, [r0,:128], r2
bgt 1b
vld1.8 {d0-d2}, [r1], r2
vadd.u16 q12, q8, q9
NRND vadd.u16 q12, q12, q13
vext.8 q15, q0, q1, #1
vadd.u16 q1 , q10, q11
shrn d28, q12, #2
NRND vadd.u16 q1, q1, q13
shrn d29, q1, #2
.if \avg
vld1.8 {q8}, [r0,:128]
vrhadd.u8 q14, q14, q8
.endif
vaddl.u8 q8, d0, d30
vaddl.u8 q10, d1, d31
vst1.8 {q14}, [r0,:128], r2
vadd.u16 q12, q8, q9
NRND vadd.u16 q12, q12, q13
vadd.u16 q0, q10, q11
shrn d30, q12, #2
NRND vadd.u16 q0, q0, q13
shrn d31, q0, #2
.if \avg
vld1.8 {q9}, [r0,:128]
vrhadd.u8 q15, q15, q9
.endif
vst1.8 {q15}, [r0,:128], r2
bx lr
.endm
.macro pixels8 rnd=1, avg=0
1: vld1.64 {d0}, [r1], r2
vld1.64 {d1}, [r1], r2
vld1.64 {d2}, [r1], r2
1: vld1.8 {d0}, [r1], r2
vld1.8 {d1}, [r1], r2
vld1.8 {d2}, [r1], r2
pld [r1, r2, lsl #2]
vld1.64 {d3}, [r1], r2
vld1.8 {d3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
.if \avg
vld1.64 {d4}, [r0,:64], r2
vld1.8 {d4}, [r0,:64], r2
vrhadd.u8 d0, d0, d4
vld1.64 {d5}, [r0,:64], r2
vld1.8 {d5}, [r0,:64], r2
vrhadd.u8 d1, d1, d5
vld1.64 {d6}, [r0,:64], r2
vld1.8 {d6}, [r0,:64], r2
vrhadd.u8 d2, d2, d6
vld1.64 {d7}, [r0,:64], r2
vld1.8 {d7}, [r0,:64], r2
vrhadd.u8 d3, d3, d7
sub r0, r0, r2, lsl #2
.endif
subs r3, r3, #4
vst1.64 {d0}, [r0,:64], r2
vst1.64 {d1}, [r0,:64], r2
vst1.64 {d2}, [r0,:64], r2
vst1.64 {d3}, [r0,:64], r2
vst1.8 {d0}, [r0,:64], r2
vst1.8 {d1}, [r0,:64], r2
vst1.8 {d2}, [r0,:64], r2
vst1.8 {d3}, [r0,:64], r2
bne 1b
bx lr
.endm
.macro pixels8_x2 rnd=1, avg=0
1: vld1.64 {q0}, [r1], r2
1: vld1.8 {q0}, [r1], r2
vext.8 d1, d0, d1, #1
vld1.64 {q1}, [r1], r2
vld1.8 {q1}, [r1], r2
vext.8 d3, d2, d3, #1
pld [r1]
pld [r1, r2]
@@ -221,20 +255,21 @@ endfunc
vrhadd.u8 q0, q0, q2
sub r0, r0, r2
.endif
vst1.64 {d0}, [r0,:64], r2
vst1.64 {d1}, [r0,:64], r2
vst1.8 {d0}, [r0,:64], r2
vst1.8 {d1}, [r0,:64], r2
bne 1b
bx lr
.endm
.macro pixels8_y2 rnd=1, avg=0
vld1.64 {d0}, [r1], r2
vld1.64 {d1}, [r1], r2
sub r3, r3, #2
vld1.8 {d0}, [r1], r2
vld1.8 {d1}, [r1], r2
1: subs r3, r3, #2
avg d4, d0, d1
vld1.64 {d0}, [r1], r2
vld1.8 {d0}, [r1], r2
avg d5, d0, d1
vld1.64 {d1}, [r1], r2
vld1.8 {d1}, [r1], r2
pld [r1]
pld [r1, r2]
.if \avg
@@ -243,18 +278,30 @@ endfunc
vrhadd.u8 q2, q2, q1
sub r0, r0, r2
.endif
vst1.64 {d4}, [r0,:64], r2
vst1.64 {d5}, [r0,:64], r2
vst1.8 {d4}, [r0,:64], r2
vst1.8 {d5}, [r0,:64], r2
bne 1b
avg d4, d0, d1
vld1.8 {d0}, [r1], r2
avg d5, d0, d1
.if \avg
vld1.8 {d2}, [r0,:64], r2
vld1.8 {d3}, [r0,:64]
vrhadd.u8 q2, q2, q1
sub r0, r0, r2
.endif
vst1.8 {d4}, [r0,:64], r2
vst1.8 {d5}, [r0,:64], r2
bx lr
.endm
.macro pixels8_xy2 rnd=1, avg=0
vld1.64 {q0}, [r1], r2
vld1.64 {q1}, [r1], r2
.ifeq \rnd
vmov.i16 q11, #1
.endif
sub r3, r3, #2
vld1.8 {q0}, [r1], r2
vld1.8 {q1}, [r1], r2
NRND vmov.i16 q11, #1
pld [r1]
pld [r1, r2]
vext.8 d4, d0, d1, #1
@@ -262,26 +309,22 @@ endfunc
vaddl.u8 q8, d0, d4
vaddl.u8 q9, d2, d6
1: subs r3, r3, #2
vld1.64 {q0}, [r1], r2
vld1.8 {q0}, [r1], r2
pld [r1]
vadd.u16 q10, q8, q9
vext.8 d4, d0, d1, #1
.ifeq \rnd
vadd.u16 q10, q10, q11
.endif
NRND vadd.u16 q10, q10, q11
vaddl.u8 q8, d0, d4
shrn d5, q10, #2
vld1.64 {q1}, [r1], r2
vld1.8 {q1}, [r1], r2
vadd.u16 q10, q8, q9
pld [r1, r2]
.if \avg
vld1.8 {d7}, [r0,:64]
vrhadd.u8 d5, d5, d7
.endif
.ifeq \rnd
vadd.u16 q10, q10, q11
.endif
vst1.64 {d5}, [r0,:64], r2
NRND vadd.u16 q10, q10, q11
vst1.8 {d5}, [r0,:64], r2
shrn d7, q10, #2
.if \avg
vld1.8 {d5}, [r0,:64]
@@ -289,8 +332,29 @@ endfunc
.endif
vext.8 d6, d2, d3, #1
vaddl.u8 q9, d2, d6
vst1.64 {d7}, [r0,:64], r2
vst1.8 {d7}, [r0,:64], r2
bgt 1b
vld1.8 {q0}, [r1], r2
vadd.u16 q10, q8, q9
vext.8 d4, d0, d1, #1
NRND vadd.u16 q10, q10, q11
vaddl.u8 q8, d0, d4
shrn d5, q10, #2
vadd.u16 q10, q8, q9
.if \avg
vld1.8 {d7}, [r0,:64]
vrhadd.u8 d5, d5, d7
.endif
NRND vadd.u16 q10, q10, q11
vst1.8 {d5}, [r0,:64], r2
shrn d7, q10, #2
.if \avg
vld1.8 {d5}, [r0,:64]
vrhadd.u8 d7, d7, d5
.endif
vst1.8 {d7}, [r0,:64], r2
bx lr
.endm
@@ -302,6 +366,8 @@ endfunc
.macro shrn rd, rn, rm
vrshrn.u16 \rd, \rn, \rm
.endm
.macro NRND insn:vararg
.endm
.else
.macro avg rd, rn, rm
vhadd.u8 \rd, \rn, \rm
@@ -309,12 +375,16 @@ endfunc
.macro shrn rd, rn, rm
vshrn.u16 \rd, \rn, \rm
.endm
.macro NRND insn:vararg
\insn
.endm
.endif
function ff_\pfx\name\suf\()_neon, export=1
\name \rnd, \avg
endfunc
.purgem avg
.purgem shrn
.purgem NRND
.endm
.macro pixfunc2 pfx, name, avg=0
@@ -359,147 +429,147 @@ endfunc
pixfunc2 avg_, pixels8_xy2, avg=1
function ff_put_pixels_clamped_neon, export=1
vld1.64 {d16-d19}, [r0,:128]!
vld1.16 {d16-d19}, [r0,:128]!
vqmovun.s16 d0, q8
vld1.64 {d20-d23}, [r0,:128]!
vld1.16 {d20-d23}, [r0,:128]!
vqmovun.s16 d1, q9
vld1.64 {d24-d27}, [r0,:128]!
vld1.16 {d24-d27}, [r0,:128]!
vqmovun.s16 d2, q10
vld1.64 {d28-d31}, [r0,:128]!
vld1.16 {d28-d31}, [r0,:128]!
vqmovun.s16 d3, q11
vst1.64 {d0}, [r1,:64], r2
vst1.8 {d0}, [r1,:64], r2
vqmovun.s16 d4, q12
vst1.64 {d1}, [r1,:64], r2
vst1.8 {d1}, [r1,:64], r2
vqmovun.s16 d5, q13
vst1.64 {d2}, [r1,:64], r2
vst1.8 {d2}, [r1,:64], r2
vqmovun.s16 d6, q14
vst1.64 {d3}, [r1,:64], r2
vst1.8 {d3}, [r1,:64], r2
vqmovun.s16 d7, q15
vst1.64 {d4}, [r1,:64], r2
vst1.64 {d5}, [r1,:64], r2
vst1.64 {d6}, [r1,:64], r2
vst1.64 {d7}, [r1,:64], r2
vst1.8 {d4}, [r1,:64], r2
vst1.8 {d5}, [r1,:64], r2
vst1.8 {d6}, [r1,:64], r2
vst1.8 {d7}, [r1,:64], r2
bx lr
endfunc
function ff_put_signed_pixels_clamped_neon, export=1
vmov.u8 d31, #128
vld1.64 {d16-d17}, [r0,:128]!
vld1.16 {d16-d17}, [r0,:128]!
vqmovn.s16 d0, q8
vld1.64 {d18-d19}, [r0,:128]!
vld1.16 {d18-d19}, [r0,:128]!
vqmovn.s16 d1, q9
vld1.64 {d16-d17}, [r0,:128]!
vld1.16 {d16-d17}, [r0,:128]!
vqmovn.s16 d2, q8
vld1.64 {d18-d19}, [r0,:128]!
vld1.16 {d18-d19}, [r0,:128]!
vadd.u8 d0, d0, d31
vld1.64 {d20-d21}, [r0,:128]!
vld1.16 {d20-d21}, [r0,:128]!
vadd.u8 d1, d1, d31
vld1.64 {d22-d23}, [r0,:128]!
vld1.16 {d22-d23}, [r0,:128]!
vadd.u8 d2, d2, d31
vst1.64 {d0}, [r1,:64], r2
vst1.8 {d0}, [r1,:64], r2
vqmovn.s16 d3, q9
vst1.64 {d1}, [r1,:64], r2
vst1.8 {d1}, [r1,:64], r2
vqmovn.s16 d4, q10
vst1.64 {d2}, [r1,:64], r2
vst1.8 {d2}, [r1,:64], r2
vqmovn.s16 d5, q11
vld1.64 {d24-d25}, [r0,:128]!
vld1.16 {d24-d25}, [r0,:128]!
vadd.u8 d3, d3, d31
vld1.64 {d26-d27}, [r0,:128]!
vld1.16 {d26-d27}, [r0,:128]!
vadd.u8 d4, d4, d31
vadd.u8 d5, d5, d31
vst1.64 {d3}, [r1,:64], r2
vst1.8 {d3}, [r1,:64], r2
vqmovn.s16 d6, q12
vst1.64 {d4}, [r1,:64], r2
vst1.8 {d4}, [r1,:64], r2
vqmovn.s16 d7, q13
vst1.64 {d5}, [r1,:64], r2
vst1.8 {d5}, [r1,:64], r2
vadd.u8 d6, d6, d31
vadd.u8 d7, d7, d31
vst1.64 {d6}, [r1,:64], r2
vst1.64 {d7}, [r1,:64], r2
vst1.8 {d6}, [r1,:64], r2
vst1.8 {d7}, [r1,:64], r2
bx lr
endfunc
function ff_add_pixels_clamped_neon, export=1
mov r3, r1
vld1.64 {d16}, [r1,:64], r2
vld1.64 {d0-d1}, [r0,:128]!
vld1.8 {d16}, [r1,:64], r2
vld1.16 {d0-d1}, [r0,:128]!
vaddw.u8 q0, q0, d16
vld1.64 {d17}, [r1,:64], r2
vld1.64 {d2-d3}, [r0,:128]!
vld1.8 {d17}, [r1,:64], r2
vld1.16 {d2-d3}, [r0,:128]!
vqmovun.s16 d0, q0
vld1.64 {d18}, [r1,:64], r2
vld1.8 {d18}, [r1,:64], r2
vaddw.u8 q1, q1, d17
vld1.64 {d4-d5}, [r0,:128]!
vld1.16 {d4-d5}, [r0,:128]!
vaddw.u8 q2, q2, d18
vst1.64 {d0}, [r3,:64], r2
vst1.8 {d0}, [r3,:64], r2
vqmovun.s16 d2, q1
vld1.64 {d19}, [r1,:64], r2
vld1.64 {d6-d7}, [r0,:128]!
vld1.8 {d19}, [r1,:64], r2
vld1.16 {d6-d7}, [r0,:128]!
vaddw.u8 q3, q3, d19
vqmovun.s16 d4, q2
vst1.64 {d2}, [r3,:64], r2
vld1.64 {d16}, [r1,:64], r2
vst1.8 {d2}, [r3,:64], r2
vld1.8 {d16}, [r1,:64], r2
vqmovun.s16 d6, q3
vld1.64 {d0-d1}, [r0,:128]!
vld1.16 {d0-d1}, [r0,:128]!
vaddw.u8 q0, q0, d16
vst1.64 {d4}, [r3,:64], r2
vld1.64 {d17}, [r1,:64], r2
vld1.64 {d2-d3}, [r0,:128]!
vst1.8 {d4}, [r3,:64], r2
vld1.8 {d17}, [r1,:64], r2
vld1.16 {d2-d3}, [r0,:128]!
vaddw.u8 q1, q1, d17
vst1.64 {d6}, [r3,:64], r2
vst1.8 {d6}, [r3,:64], r2
vqmovun.s16 d0, q0
vld1.64 {d18}, [r1,:64], r2
vld1.64 {d4-d5}, [r0,:128]!
vld1.8 {d18}, [r1,:64], r2
vld1.16 {d4-d5}, [r0,:128]!
vaddw.u8 q2, q2, d18
vst1.64 {d0}, [r3,:64], r2
vst1.8 {d0}, [r3,:64], r2
vqmovun.s16 d2, q1
vld1.64 {d19}, [r1,:64], r2
vld1.8 {d19}, [r1,:64], r2
vqmovun.s16 d4, q2
vld1.64 {d6-d7}, [r0,:128]!
vld1.16 {d6-d7}, [r0,:128]!
vaddw.u8 q3, q3, d19
vst1.64 {d2}, [r3,:64], r2
vst1.8 {d2}, [r3,:64], r2
vqmovun.s16 d6, q3
vst1.64 {d4}, [r3,:64], r2
vst1.64 {d6}, [r3,:64], r2
vst1.8 {d4}, [r3,:64], r2
vst1.8 {d6}, [r3,:64], r2
bx lr
endfunc
function ff_vector_fmul_neon, export=1
subs r3, r3, #8
vld1.64 {d0-d3}, [r1,:128]!
vld1.64 {d4-d7}, [r2,:128]!
vld1.32 {d0-d3}, [r1,:128]!
vld1.32 {d4-d7}, [r2,:128]!
vmul.f32 q8, q0, q2
vmul.f32 q9, q1, q3
beq 3f
bics ip, r3, #15
beq 2f
1: subs ip, ip, #16
vld1.64 {d0-d1}, [r1,:128]!
vld1.64 {d4-d5}, [r2,:128]!
vld1.32 {d0-d1}, [r1,:128]!
vld1.32 {d4-d5}, [r2,:128]!
vmul.f32 q10, q0, q2
vld1.64 {d2-d3}, [r1,:128]!
vld1.64 {d6-d7}, [r2,:128]!
vld1.32 {d2-d3}, [r1,:128]!
vld1.32 {d6-d7}, [r2,:128]!
vmul.f32 q11, q1, q3
vst1.64 {d16-d19},[r0,:128]!
vld1.64 {d0-d1}, [r1,:128]!
vld1.64 {d4-d5}, [r2,:128]!
vst1.32 {d16-d19},[r0,:128]!
vld1.32 {d0-d1}, [r1,:128]!
vld1.32 {d4-d5}, [r2,:128]!
vmul.f32 q8, q0, q2
vld1.64 {d2-d3}, [r1,:128]!
vld1.64 {d6-d7}, [r2,:128]!
vld1.32 {d2-d3}, [r1,:128]!
vld1.32 {d6-d7}, [r2,:128]!
vmul.f32 q9, q1, q3
vst1.64 {d20-d23},[r0,:128]!
vst1.32 {d20-d23},[r0,:128]!
bne 1b
ands r3, r3, #15
beq 3f
2: vld1.64 {d0-d1}, [r1,:128]!
vld1.64 {d4-d5}, [r2,:128]!
vst1.64 {d16-d17},[r0,:128]!
2: vld1.32 {d0-d1}, [r1,:128]!
vld1.32 {d4-d5}, [r2,:128]!
vst1.32 {d16-d17},[r0,:128]!
vmul.f32 q8, q0, q2
vld1.64 {d2-d3}, [r1,:128]!
vld1.64 {d6-d7}, [r2,:128]!
vst1.64 {d18-d19},[r0,:128]!
vld1.32 {d2-d3}, [r1,:128]!
vld1.32 {d6-d7}, [r2,:128]!
vst1.32 {d18-d19},[r0,:128]!
vmul.f32 q9, q1, q3
3: vst1.64 {d16-d19},[r0,:128]!
3: vst1.32 {d16-d19},[r0,:128]!
bx lr
endfunc
@@ -512,10 +582,10 @@ function ff_vector_fmul_window_neon, export=1
add r4, r3, r5, lsl #3
add ip, r0, r5, lsl #3
mov r5, #-16
vld1.64 {d0,d1}, [r1,:128]!
vld1.64 {d2,d3}, [r2,:128], r5
vld1.64 {d4,d5}, [r3,:128]!
vld1.64 {d6,d7}, [r4,:128], r5
vld1.32 {d0,d1}, [r1,:128]!
vld1.32 {d2,d3}, [r2,:128], r5
vld1.32 {d4,d5}, [r3,:128]!
vld1.32 {d6,d7}, [r4,:128], r5
1: subs lr, lr, #4
vmul.f32 d22, d0, d4
vrev64.32 q3, q3
@@ -525,19 +595,19 @@ function ff_vector_fmul_window_neon, export=1
vmul.f32 d21, d1, d6
beq 2f
vmla.f32 d22, d3, d7
vld1.64 {d0,d1}, [r1,:128]!
vld1.32 {d0,d1}, [r1,:128]!
vmla.f32 d23, d2, d6
vld1.64 {d18,d19},[r2,:128], r5
vld1.32 {d18,d19},[r2,:128], r5
vmls.f32 d20, d3, d4
vld1.64 {d24,d25},[r3,:128]!
vld1.32 {d24,d25},[r3,:128]!
vmls.f32 d21, d2, d5
vld1.64 {d6,d7}, [r4,:128], r5
vld1.32 {d6,d7}, [r4,:128], r5
vmov q1, q9
vrev64.32 q11, q11
vmov q2, q12
vswp d22, d23
vst1.64 {d20,d21},[r0,:128]!
vst1.64 {d22,d23},[ip,:128], r5
vst1.32 {d20,d21},[r0,:128]!
vst1.32 {d22,d23},[ip,:128], r5
b 1b
2: vmla.f32 d22, d3, d7
vmla.f32 d23, d2, d6
@@ -545,8 +615,8 @@ function ff_vector_fmul_window_neon, export=1
vmls.f32 d21, d2, d5
vrev64.32 q11, q11
vswp d22, d23
vst1.64 {d20,d21},[r0,:128]!
vst1.64 {d22,d23},[ip,:128], r5
vst1.32 {d20,d21},[r0,:128]!
vst1.32 {d22,d23},[ip,:128], r5
pop {r4,r5,pc}
endfunc

View File

@@ -89,7 +89,7 @@ static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const i
c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;
c->h264_idct_add16 = ff_h264_idct_add16_neon;
c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
if (chroma_format_idc == 1)
if (chroma_format_idc <= 1)
c->h264_idct_add8 = ff_h264_idct_add8_neon;
c->h264_idct8_add = ff_h264_idct8_add_neon;
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon;

View File

@@ -66,10 +66,10 @@ function ff_scalarproduct_int16_neon, export=1
3: vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
vpadd.s32 d10, d4, d5
vpadd.s32 d11, d6, d7
vpadd.s32 d18, d4, d5
vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
vpadd.s32 d1, d10, d11
vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]
@@ -106,10 +106,10 @@ function ff_scalarproduct_and_madd_int16_neon, export=1
vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
vpadd.s32 d10, d4, d5
vpadd.s32 d11, d6, d7
vpadd.s32 d18, d4, d5
vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
vpadd.s32 d1, d10, d11
vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]

View File

@@ -366,7 +366,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv,
char new_line[2];
int text_len = 0;
while (*buf) {
while (buf && *buf) {
if (text && callbacks->text &&
(sscanf(buf, "\\%1[nN]", new_line) == 1 ||
!strncmp(buf, "{\\", 2))) {

View File

@@ -535,6 +535,11 @@ static av_cold int decode_init(AVCodecContext *avctx){
int i;
const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
if (avctx->extradata_size < 1) {
av_log(avctx, AV_LOG_ERROR, "No extradata provided\n");
return AVERROR_INVALIDDATA;
}
common_init(avctx);
init_vlcs(a);
ff_init_scantable(a->dsp.idct_permutation, &a->scantable, scantab);

View File

@@ -33,6 +33,7 @@
#include <stdio.h>
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
@@ -291,7 +292,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
q->frame.nb_samples = AT1_SU_SAMPLES;
if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -37,6 +37,7 @@
#include <stdio.h>
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "dsputil.h"
#include "bytestream.h"
@@ -184,8 +185,11 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
uint32_t* obuf = (uint32_t*) out;
off = (intptr_t)inbuffer & 3;
buf = (const uint32_t*) (inbuffer - off);
c = av_be2ne32((0x537F6103 >> (off*8)) | (0x537F6103 << (32-(off*8))));
buf = (const uint32_t *)(inbuffer - off);
if (off)
c = av_be2ne32((0x537F6103U >> (off * 8)) | (0x537F6103U << (32 - (off * 8))));
else
c = av_be2ne32(0x537F6103U);
bytes += 3 + off;
for (i = 0; i < bytes/4; i++)
obuf[i] = c ^ buf[i];
@@ -402,7 +406,7 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent
for (k=0; k<coded_components; k++) {
sfIndx = get_bits(gb,6);
if(component_count>=64)
if (component_count >= 64)
return AVERROR_INVALIDDATA;
pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
max_coded_values = SAMPLES_PER_FRAME - pComponent[component_count].pos;
@@ -687,7 +691,8 @@ static int decodeChannelSoundUnit (ATRAC3Context *q, GetBitContext *gb, channel_
if (result) return result;
pSnd->numComponents = decodeTonalComponents (gb, pSnd->components, pSnd->bandsCoded);
if (pSnd->numComponents == -1) return -1;
if (pSnd->numComponents < 0)
return pSnd->numComponents;
numSubbands = decodeSpectrum (gb, pSnd->spectrum);
@@ -769,7 +774,7 @@ static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf,
/* set the bitstream reader at the start of the second Sound Unit*/
init_get_bits(&q->gb,ptr1,q->bits_per_frame);
init_get_bits(&q->gb, ptr1, (q->bytes_per_frame - i) * 8);
/* Fill the Weighting coeffs delay buffer */
memmove(q->weighting_delay,&(q->weighting_delay[2]),4*sizeof(int));
@@ -848,7 +853,7 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
q->frame.nb_samples = SAMPLES_PER_FRAME;
if ((result = avctx->get_buffer(avctx, &q->frame)) < 0) {
if ((result = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
}
@@ -972,6 +977,8 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
if (q->codingMode == STEREO) {
av_log(avctx,AV_LOG_DEBUG,"Normal stereo detected.\n");
} else if (q->codingMode == JOINT_STEREO) {
if (avctx->channels != 2)
return AVERROR_INVALIDDATA;
av_log(avctx,AV_LOG_DEBUG,"Joint stereo detected.\n");
} else {
av_log(avctx,AV_LOG_ERROR,"Unknown channel coding mode %x!\n",q->codingMode);

View File

@@ -4032,7 +4032,8 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
/**
* Allocate an AVCodecContext and set its fields to default values. The
* resulting struct can be deallocated by simply calling av_free().
* resulting struct can be deallocated by calling avcodec_close() on it followed
* by av_free().
*
* @param codec if non-NULL, allocate private data and initialize defaults
* for the given codec. It is illegal to then call avcodec_open2()
@@ -4178,6 +4179,11 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
* @endcode
*
* @param avctx The context to initialize.
* @param codec The codec to open this context for. If a non-NULL codec has been
* previously passed to avcodec_alloc_context3() or
* avcodec_get_context_defaults3() for this context, then this
* parameter MUST be either NULL or equal to the previously passed
* codec.
* @param options A dictionary filled with AVCodecContext and codec-private options.
* On return this object will be filled with options that were not found.
*
@@ -4463,6 +4469,15 @@ int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVSubtitle *sub);
/**
* Close a given AVCodecContext and free all the data associated with it
* (but not the AVCodecContext itself).
*
* Calling this function on an AVCodecContext that hasn't been opened will free
* the codec-specific data allocated in avcodec_alloc_context3() /
* avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
* do nothing.
*/
int avcodec_close(AVCodecContext *avctx);
/**
@@ -4874,4 +4889,10 @@ const AVClass *avcodec_get_class(void);
*/
const AVClass *avcodec_get_frame_class(void);
/**
* @return a positive value if s is open (i.e. avcodec_open2() was called on it
* with no corresponding avcodec_close()), 0 otherwise.
*/
int avcodec_is_open(AVCodecContext *s);
#endif /* AVCODEC_AVCODEC_H */

View File

@@ -162,6 +162,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
AvsContext *const avs = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&avs->picture);
avcodec_set_dimensions(avctx, 318, 198);
return 0;
}

View File

@@ -167,7 +167,7 @@ static void init_lengths(BinkContext *c, int width, int bw)
*
* @param c decoder context
*/
static av_cold void init_bundles(BinkContext *c)
static av_cold int init_bundles(BinkContext *c)
{
int bw, bh, blocks;
int i;
@@ -178,8 +178,12 @@ static av_cold void init_bundles(BinkContext *c)
for (i = 0; i < BINKB_NB_SRC; i++) {
c->bundle[i].data = av_malloc(blocks * 64);
if (!c->bundle[i].data)
return AVERROR(ENOMEM);
c->bundle[i].data_end = c->bundle[i].data + blocks * 64;
}
return 0;
}
/**
@@ -675,6 +679,9 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
quant_idx = q;
}
if (quant_idx >= 16)
return AVERROR_INVALIDDATA;
quant = quant_matrices[quant_idx];
block[0] = (block[0] * quant[0]) >> 11;
@@ -1266,7 +1273,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
BinkContext * const c = avctx->priv_data;
static VLC_TYPE table[16 * 128][2];
static int binkb_initialised = 0;
int i;
int i, ret;
int flags;
c->version = avctx->codec_tag >> 24;
@@ -1301,7 +1308,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
dsputil_init(&c->dsp, avctx);
ff_binkdsp_init(&c->bdsp);
init_bundles(c);
if ((ret = init_bundles(c)) < 0) {
free_bundles(c);
return ret;
}
if (c->version == 'b') {
if (!binkb_initialised) {

View File

@@ -29,6 +29,7 @@
*/
#include "avcodec.h"
#include "internal.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "dsputil.h"
@@ -91,9 +92,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
frame_len_bits = 11;
}
if (avctx->channels > MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels);
return -1;
if (avctx->channels < 1 || avctx->channels > MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels);
return AVERROR_INVALIDDATA;
}
s->version_b = avctx->extradata && avctx->extradata[3] == 'b';
@@ -340,7 +341,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = s->block_size / avctx->channels;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -253,9 +253,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
(byte/word/long) to store the 'bits', 'codes', and 'symbols' tables.
'use_static' should be set to 1 for tables, which should be freed
with av_free_static(), 0 if free_vlc() will be used.
with av_free_static(), 0 if ff_free_vlc() will be used.
*/
int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
const void *bits, int bits_wrap, int bits_size,
const void *codes, int codes_wrap, int codes_size,
const void *symbols, int symbols_wrap, int symbols_size,
@@ -318,7 +318,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
}
void free_vlc(VLC *vlc)
void ff_free_vlc(VLC *vlc)
{
av_freep(&vlc->table);
}

View File

@@ -53,6 +53,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
uint8_t *ptr;
int dsize;
const uint8_t *buf0 = buf;
GetByteContext gb;
if(buf_size < 14){
av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size);
@@ -117,7 +118,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
depth = bytestream_get_le16(&buf);
if(ihsize == 40 || ihsize == 64 || ihsize == 56)
if (ihsize >= 40)
comp = bytestream_get_le32(&buf);
else
comp = BMP_RGB;
@@ -132,8 +133,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
rgb[0] = bytestream_get_le32(&buf);
rgb[1] = bytestream_get_le32(&buf);
rgb[2] = bytestream_get_le32(&buf);
if (ihsize >= 108)
alpha = bytestream_get_le32(&buf);
alpha = bytestream_get_le32(&buf);
}
avctx->width = width;
@@ -231,9 +231,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
if(comp == BMP_RLE4 || comp == BMP_RLE8)
memset(p->data[0], 0, avctx->height * p->linesize[0]);
if(depth == 4 || depth == 8)
memset(p->data[1], 0, 1024);
if(height > 0){
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
linesize = -p->linesize[0];
@@ -244,6 +241,9 @@ static int bmp_decode_frame(AVCodecContext *avctx,
if(avctx->pix_fmt == PIX_FMT_PAL8){
int colors = 1 << depth;
memset(p->data[1], 0, 1024);
if(ihsize >= 36){
int t;
buf = buf0 + 46;
@@ -269,7 +269,8 @@ static int bmp_decode_frame(AVCodecContext *avctx,
p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];
}
ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize);
bytestream2_init(&gb, buf, dsize);
ff_msrle_decode(avctx, (AVPicture*)p, depth, &gb);
if(height < 0){
p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];

View File

@@ -20,7 +20,9 @@
*/
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
#include "libavutil/avassert.h"
enum BMVFlags{
BMV_NOP = 0,
@@ -52,7 +54,7 @@ typedef struct BMVDecContext {
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
{
int val, saved_val = 0;
unsigned val, saved_val = 0;
int tmplen = src_len;
const uint8_t *src, *source_end = source + src_len;
uint8_t *frame_end = frame + SCREEN_WIDE * SCREEN_HIGH;
@@ -98,6 +100,8 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
}
if (!(val & 0xC)) {
for (;;) {
if(shift>22)
return -1;
if (!read_two_nibbles) {
if (src < source || src >= source_end)
return -1;
@@ -131,15 +135,16 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
}
advance_mode = val & 1;
len = (val >> 1) - 1;
av_assert0(len>0);
mode += 1 + advance_mode;
if (mode >= 4)
mode -= 3;
if (FFABS(dst_end - dst) < len)
if (len <= 0 || FFABS(dst_end - dst) < len)
return -1;
switch (mode) {
case 1:
if (forward) {
if (dst - frame + SCREEN_WIDE < frame_off ||
if (dst - frame + SCREEN_WIDE < -frame_off ||
frame_end - dst < frame_off + len)
return -1;
for (i = 0; i < len; i++)
@@ -147,7 +152,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
dst += len;
} else {
dst -= len;
if (dst - frame + SCREEN_WIDE < frame_off ||
if (dst - frame + SCREEN_WIDE < -frame_off ||
frame_end - dst < frame_off + len)
return -1;
for (i = len - 1; i >= 0; i--)
@@ -264,8 +269,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (avctx->width != SCREEN_WIDE || avctx->height != SCREEN_HIGH) {
av_log(avctx, AV_LOG_ERROR, "Invalid dimension %dx%d\n", avctx->width, avctx->height);
return AVERROR_INVALIDDATA;
}
c->pic.reference = 1;
if (avctx->get_buffer(avctx, &c->pic) < 0) {
if (ff_get_buffer(avctx, &c->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -330,7 +340,7 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = total_blocks * 32;
if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -1,6 +1,7 @@
/*
* Bytestream functions
* copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
* Copyright (c) 2012 Aneesh Dogra (lionaneesh) <lionaneesh@gmail.com>
*
* This file is part of FFmpeg.
*
@@ -23,6 +24,7 @@
#define AVCODEC_BYTESTREAM_H
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
@@ -30,35 +32,57 @@ typedef struct {
const uint8_t *buffer, *buffer_end, *buffer_start;
} GetByteContext;
#define DEF_T(type, name, bytes, read, write) \
static av_always_inline type bytestream_get_ ## name(const uint8_t **b){\
(*b) += bytes;\
return read(*b - bytes);\
}\
static av_always_inline void bytestream_put_ ##name(uint8_t **b, const type value){\
write(*b, value);\
(*b) += bytes;\
}\
static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g)\
{\
return bytestream_get_ ## name(&g->buffer);\
}\
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g)\
{\
if (g->buffer_end - g->buffer < bytes)\
return 0;\
return bytestream2_get_ ## name ## u(g);\
}\
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g)\
{\
if (g->buffer_end - g->buffer < bytes)\
return 0;\
return read(g->buffer);\
typedef struct {
uint8_t *buffer, *buffer_end, *buffer_start;
int eof;
} PutByteContext;
#define DEF_T(type, name, bytes, read, write) \
static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \
{ \
(*b) += bytes; \
return read(*b - bytes); \
} \
static av_always_inline void bytestream_put_ ## name(uint8_t **b, \
const type value) \
{ \
write(*b, value); \
(*b) += bytes; \
} \
static av_always_inline void bytestream2_put_ ## name ## u(PutByteContext *p, \
const type value) \
{ \
bytestream_put_ ## name(&p->buffer, value); \
} \
static av_always_inline void bytestream2_put_ ## name(PutByteContext *p, \
const type value) \
{ \
if (!p->eof && (p->buffer_end - p->buffer >= bytes)) { \
write(p->buffer, value); \
p->buffer += bytes; \
} else \
p->eof = 1; \
} \
static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \
{ \
return bytestream_get_ ## name(&g->buffer); \
} \
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \
{ \
if (g->buffer_end - g->buffer < bytes) \
return 0; \
return bytestream2_get_ ## name ## u(g); \
} \
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
{ \
if (g->buffer_end - g->buffer < bytes) \
return 0; \
return read(g->buffer); \
}
#define DEF(name, bytes, read, write) \
#define DEF(name, bytes, read, write) \
DEF_T(unsigned int, name, bytes, read, write)
#define DEF64(name, bytes, read, write) \
#define DEF64(name, bytes, read, write) \
DEF_T(uint64_t, name, bytes, read, write)
DEF64(le64, 8, AV_RL64, AV_WL64)
@@ -112,11 +136,22 @@ DEF (byte, 1, AV_RB8 , AV_WB8 )
#endif
static av_always_inline void bytestream2_init(GetByteContext *g,
const uint8_t *buf, int buf_size)
const uint8_t *buf,
int buf_size)
{
g->buffer = buf;
g->buffer = buf;
g->buffer_start = buf;
g->buffer_end = buf + buf_size;
g->buffer_end = buf + buf_size;
}
static av_always_inline void bytestream2_init_writer(PutByteContext *p,
uint8_t *buf,
int buf_size)
{
p->buffer = buf;
p->buffer_start = buf;
p->buffer_end = buf + buf_size;
p->eof = 0;
}
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
@@ -124,32 +159,71 @@ static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *
return g->buffer_end - g->buffer;
}
static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p)
{
return p->buffer_end - p->buffer;
}
static av_always_inline void bytestream2_skip(GetByteContext *g,
unsigned int size)
{
g->buffer += FFMIN(g->buffer_end - g->buffer, size);
}
static av_always_inline void bytestream2_skipu(GetByteContext *g,
unsigned int size)
{
g->buffer += size;
}
static av_always_inline void bytestream2_skip_p(PutByteContext *p,
unsigned int size)
{
int size2;
if (p->eof)
return;
size2 = FFMIN(p->buffer_end - p->buffer, size);
if (size2 != size)
p->eof = 1;
p->buffer += size2;
}
static av_always_inline int bytestream2_tell(GetByteContext *g)
{
return (int)(g->buffer - g->buffer_start);
}
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset,
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
{
return (int)(p->buffer - p->buffer_start);
}
static av_always_inline int bytestream2_size(GetByteContext *g)
{
return (int)(g->buffer_end - g->buffer_start);
}
static av_always_inline int bytestream2_size_p(PutByteContext *p)
{
return (int)(p->buffer_end - p->buffer_start);
}
static av_always_inline int bytestream2_seek(GetByteContext *g,
int offset,
int whence)
{
switch (whence) {
case SEEK_CUR:
offset = av_clip(offset, -(g->buffer - g->buffer_start),
g->buffer_end - g->buffer);
offset = av_clip(offset, -(g->buffer - g->buffer_start),
g->buffer_end - g->buffer);
g->buffer += offset;
break;
case SEEK_END:
offset = av_clip(offset, -(g->buffer_end - g->buffer_start), 0);
offset = av_clip(offset, -(g->buffer_end - g->buffer_start), 0);
g->buffer = g->buffer_end + offset;
break;
case SEEK_SET:
offset = av_clip(offset, 0, g->buffer_end - g->buffer_start);
offset = av_clip(offset, 0, g->buffer_end - g->buffer_start);
g->buffer = g->buffer_start + offset;
break;
default:
@@ -158,6 +232,37 @@ static av_always_inline int bytestream2_seek(GetByteContext *g, int offset,
return bytestream2_tell(g);
}
static av_always_inline int bytestream2_seek_p(PutByteContext *p,
int offset,
int whence)
{
p->eof = 0;
switch (whence) {
case SEEK_CUR:
if (p->buffer_end - p->buffer < offset)
p->eof = 1;
offset = av_clip(offset, -(p->buffer - p->buffer_start),
p->buffer_end - p->buffer);
p->buffer += offset;
break;
case SEEK_END:
if (offset > 0)
p->eof = 1;
offset = av_clip(offset, -(p->buffer_end - p->buffer_start), 0);
p->buffer = p->buffer_end + offset;
break;
case SEEK_SET:
if (p->buffer_end - p->buffer_start < offset)
p->eof = 1;
offset = av_clip(offset, 0, p->buffer_end - p->buffer_start);
p->buffer = p->buffer_start + offset;
break;
default:
return AVERROR(EINVAL);
}
return bytestream2_tell_p(p);
}
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g,
uint8_t *dst,
unsigned int size)
@@ -168,14 +273,104 @@ static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g,
return size2;
}
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g,
uint8_t *dst,
unsigned int size)
{
memcpy(dst, g->buffer, size);
g->buffer += size;
return size;
}
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p,
const uint8_t *src,
unsigned int size)
{
int size2;
if (p->eof)
return 0;
size2 = FFMIN(p->buffer_end - p->buffer, size);
if (size2 != size)
p->eof = 1;
memcpy(p->buffer, src, size2);
p->buffer += size2;
return size2;
}
static av_always_inline unsigned int bytestream2_put_bufferu(PutByteContext *p,
const uint8_t *src,
unsigned int size)
{
memcpy(p->buffer, src, size);
p->buffer += size;
return size;
}
static av_always_inline void bytestream2_set_buffer(PutByteContext *p,
const uint8_t c,
unsigned int size)
{
int size2;
if (p->eof)
return;
size2 = FFMIN(p->buffer_end - p->buffer, size);
if (size2 != size)
p->eof = 1;
memset(p->buffer, c, size2);
p->buffer += size2;
}
static av_always_inline void bytestream2_set_bufferu(PutByteContext *p,
const uint8_t c,
unsigned int size)
{
memset(p->buffer, c, size);
p->buffer += size;
}
static av_always_inline unsigned int bytestream2_get_eof(PutByteContext *p)
{
return p->eof;
}
static av_always_inline unsigned int bytestream2_copy_bufferu(PutByteContext *p,
GetByteContext *g,
unsigned int size)
{
memcpy(p->buffer, g->buffer, size);
p->buffer += size;
g->buffer += size;
return size;
}
static av_always_inline unsigned int bytestream2_copy_buffer(PutByteContext *p,
GetByteContext *g,
unsigned int size)
{
int size2;
if (p->eof)
return 0;
size = FFMIN(g->buffer_end - g->buffer, size);
size2 = FFMIN(p->buffer_end - p->buffer, size);
if (size2 != size)
p->eof = 1;
return bytestream2_copy_bufferu(p, g, size2);
}
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b,
uint8_t *dst,
unsigned int size)
{
memcpy(dst, *b, size);
(*b) += size;
return size;
}
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
static av_always_inline void bytestream_put_buffer(uint8_t **b,
const uint8_t *src,
unsigned int size)
{
memcpy(*b, src, size);
(*b) += size;

View File

@@ -166,8 +166,8 @@ static inline int decode_residual_inter(AVSContext *h) {
/* get coded block pattern */
int cbp= get_ue_golomb(&h->s.gb);
if(cbp > 63U){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp\n");
if(cbp > 63 || cbp < 0){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp %d\n", cbp);
return -1;
}
h->cbp = cbp_tab[cbp][1];
@@ -226,7 +226,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
/* get coded block pattern */
if(h->pic_type == AV_PICTURE_TYPE_I)
cbp_code = get_ue_golomb(gb);
if(cbp_code > 63U){
if(cbp_code > 63 || cbp_code < 0 ){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n");
return -1;
}
@@ -468,6 +468,11 @@ static int decode_pic(AVSContext *h) {
int skip_count = -1;
enum cavs_mb mb_type;
if (!h->top_qp) {
av_log(h, AV_LOG_ERROR, "No sequence header decoded yet\n");
return AVERROR_INVALIDDATA;
}
if (!s->context_initialized) {
s->avctx->idct_algo = FF_IDCT_CAVS;
if (MPV_common_init(s) < 0)
@@ -609,12 +614,21 @@ static int decode_pic(AVSContext *h) {
static int decode_seq_header(AVSContext *h) {
MpegEncContext *s = &h->s;
int frame_rate_code;
int width, height;
h->profile = get_bits(&s->gb,8);
h->level = get_bits(&s->gb,8);
skip_bits1(&s->gb); //progressive sequence
s->width = get_bits(&s->gb,14);
s->height = get_bits(&s->gb,14);
width = get_bits(&s->gb, 14);
height = get_bits(&s->gb, 14);
if ((s->width || s->height) && (s->width != width || s->height != height)) {
av_log_missing_feature(s, "Width/height changing in CAVS is", 0);
return AVERROR_PATCHWELCOME;
}
s->width = width;
s->height = height;
skip_bits(&s->gb,2); //chroma format
skip_bits(&s->gb,3); //sample_precision
h->aspect_ratio = get_bits(&s->gb,4);
@@ -656,7 +670,8 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
if (buf_size == 0) {
if (!s->low_delay && h->DPB[0].f.data[0]) {
*data_size = sizeof(AVPicture);
*picture = *(AVFrame *) &h->DPB[0];
*picture = h->DPB[0].f;
memset(&h->DPB[0], 0, sizeof(h->DPB[0]));
}
return 0;
}

View File

@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
/**
@@ -268,7 +269,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
static int cdg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
GetByteContext gb;
int buf_size = avpkt->size;
int ret;
uint8_t command, inst;
@@ -280,6 +281,12 @@ static int cdg_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n");
return AVERROR(EINVAL);
}
if (buf_size > CDG_HEADER_SIZE + CDG_DATA_SIZE) {
av_log(avctx, AV_LOG_ERROR, "buffer too big for decoder\n");
return AVERROR(EINVAL);
}
bytestream2_init(&gb, avpkt->data, avpkt->size);
ret = avctx->reget_buffer(avctx, &cc->frame);
if (ret) {
@@ -287,11 +294,11 @@ static int cdg_decode_frame(AVCodecContext *avctx,
return ret;
}
command = bytestream_get_byte(&buf);
inst = bytestream_get_byte(&buf);
command = bytestream2_get_byte(&gb);
inst = bytestream2_get_byte(&gb);
inst &= CDG_MASK;
buf += 2; /// skipping 2 unneeded bytes
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
bytestream2_skip(&gb, 2);
bytestream2_get_buffer(&gb, cdg_data, sizeof(cdg_data));
if ((command & CDG_MASK) == CDG_COMMAND) {
switch (inst) {
@@ -333,7 +340,7 @@ static int cdg_decode_frame(AVCodecContext *avctx,
}
cdg_init_frame(&new_frame);
ret = avctx->get_buffer(avctx, &new_frame);
ret = ff_get_buffer(avctx, &new_frame);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
@@ -350,11 +357,10 @@ static int cdg_decode_frame(AVCodecContext *avctx,
*data_size = sizeof(AVFrame);
} else {
*data_size = 0;
buf_size = 0;
}
*(AVFrame *) data = cc->frame;
return buf_size;
return avpkt->size;
}
static av_cold int cdg_decode_end(AVCodecContext *avctx)

View File

@@ -133,9 +133,8 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
out2 -= val * old_out2;
out3 -= val * old_out3;
old_out3 = out[-5];
for (i = 5; i <= filter_length; i += 2) {
old_out3 = out[-i];
val = filter_coeffs[i-1];
out0 -= val * old_out3;
@@ -154,7 +153,6 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
FFSWAP(float, old_out0, old_out2);
old_out1 = old_out3;
old_out3 = out[-i-2];
}
tmp0 = out0;

View File

@@ -44,6 +44,7 @@
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
#include "dsputil.h"
#include "bytestream.h"
@@ -321,11 +322,11 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
/* Free the VLC tables. */
for (i = 0; i < 13; i++)
free_vlc(&q->envelope_quant_index[i]);
ff_free_vlc(&q->envelope_quant_index[i]);
for (i = 0; i < 7; i++)
free_vlc(&q->sqvh[i]);
ff_free_vlc(&q->sqvh[i]);
for (i = 0; i < q->num_subpackets; i++)
free_vlc(&q->subpacket[i].ccpl);
ff_free_vlc(&q->subpacket[i].ccpl);
av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n");
@@ -366,8 +367,8 @@ static void decode_gain_info(GetBitContext *gb, int *gaininfo)
* @param q pointer to the COOKContext
* @param quant_index_table pointer to the array
*/
static void decode_envelope(COOKContext *q, COOKSubpacket *p,
int *quant_index_table)
static int decode_envelope(COOKContext *q, COOKSubpacket *p,
int *quant_index_table)
{
int i, j, vlc_index;
@@ -388,7 +389,15 @@ static void decode_envelope(COOKContext *q, COOKSubpacket *p,
j = get_vlc2(&q->gb, q->envelope_quant_index[vlc_index - 1].table,
q->envelope_quant_index[vlc_index - 1].bits, 2);
quant_index_table[i] = quant_index_table[i - 1] + j - 12; // differential encoding
if (quant_index_table[i] > 63 || quant_index_table[i] < -63) {
av_log(q->avctx, AV_LOG_ERROR,
"Invalid quantizer %d at position %d, outside [-63, 63] range\n",
quant_index_table[i], i);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
/**
@@ -507,7 +516,11 @@ static inline void expand_category(COOKContext *q, int *category,
{
int i;
for (i = 0; i < q->num_vectors; i++)
++category[category_index[i]];
{
int idx = category_index[i];
if (++category[idx] >= FF_ARRAY_ELEMS(dither_tab))
--category[idx];
}
}
/**
@@ -635,20 +648,24 @@ static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category,
* @param q pointer to the COOKContext
* @param mlt_buffer pointer to mlt coefficients
*/
static void mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
{
int category_index[128];
int quant_index_table[102];
int category[128];
int res;
memset(&category, 0, sizeof(category));
memset(&category_index, 0, sizeof(category_index));
decode_envelope(q, p, quant_index_table);
if ((res = decode_envelope(q, p, quant_index_table)) < 0)
return res;
q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);
categorize(q, p, quant_index_table, category, category_index);
expand_category(q, category, category_index);
decode_vectors(q, p, category, quant_index_table, mlt_buffer);
return 0;
}
@@ -798,10 +815,10 @@ static void decouple_float(COOKContext *q,
* @param mlt_buffer1 pointer to left channel mlt coefficients
* @param mlt_buffer2 pointer to right channel mlt coefficients
*/
static void joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
float *mlt_buffer2)
static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
float *mlt_buffer2)
{
int i, j;
int i, j, res;
int decouple_tab[SUBBAND_SIZE];
float *decode_buffer = q->decode_buffer_0;
int idx, cpl_tmp;
@@ -815,7 +832,8 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
memset(mlt_buffer1, 0, 1024 * sizeof(*mlt_buffer1));
memset(mlt_buffer2, 0, 1024 * sizeof(*mlt_buffer2));
decouple_info(q, p, decouple_tab);
mono_decode(q, p, decode_buffer);
if ((res = mono_decode(q, p, decode_buffer)) < 0)
return res;
/* The two channels are stored interleaved in decode_buffer. */
for (i = 0; i < p->js_subband_start; i++) {
@@ -832,11 +850,13 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
cpl_tmp = cplband[i];
idx -= decouple_tab[cpl_tmp];
cplscale = q->cplscales[p->js_vlc_bits - 2]; // choose decoupler table
f1 = cplscale[decouple_tab[cpl_tmp]];
f2 = cplscale[idx - 1];
f1 = cplscale[decouple_tab[cpl_tmp] + 1];
f2 = cplscale[idx];
q->decouple(q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
idx = (1 << p->js_vlc_bits) - 1;
}
return 0;
}
/**
@@ -909,10 +929,11 @@ static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer,
* @param inbuffer pointer to the inbuffer
* @param outbuffer pointer to the outbuffer
*/
static void decode_subpacket(COOKContext *q, COOKSubpacket *p,
const uint8_t *inbuffer, float *outbuffer)
static int decode_subpacket(COOKContext *q, COOKSubpacket *p,
const uint8_t *inbuffer, float *outbuffer)
{
int sub_packet_size = p->size;
int res;
/* packet dump */
// for (i = 0; i < sub_packet_size ; i++)
// av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]);
@@ -921,13 +942,16 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p,
decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
if (p->joint_stereo) {
joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2);
if ((res = joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)
return res;
} else {
mono_decode(q, p, q->decode_buffer_1);
if ((res = mono_decode(q, p, q->decode_buffer_1)) < 0)
return res;
if (p->num_channels == 2) {
decode_bytes_and_gain(q, p, inbuffer + sub_packet_size / 2, &p->gains2);
mono_decode(q, p, q->decode_buffer_2);
if ((res = mono_decode(q, p, q->decode_buffer_2)) < 0)
return res;
}
}
@@ -941,6 +965,8 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p,
else
mlt_compensate_output(q, q->decode_buffer_2, &p->gains2,
p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
return 0;
}
@@ -966,7 +992,7 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
if (q->discarded_packets >= 2) {
q->frame.nb_samples = q->samples_per_channel;
if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -996,7 +1022,8 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data,
i, q->subpacket[i].size, q->subpacket[i].joint_stereo, offset,
avctx->block_align);
decode_subpacket(q, &q->subpacket[i], buf + offset, samples);
if ((ret = decode_subpacket(q, &q->subpacket[i], buf + offset, samples)) < 0)
return ret;
offset += q->subpacket[i].size;
chidx += q->subpacket[i].num_channels;
av_log(avctx, AV_LOG_DEBUG, "subpacket[%i] %i %i\n",
@@ -1078,6 +1105,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->sample_rate = avctx->sample_rate;
q->nb_channels = avctx->channels;
q->bit_rate = avctx->bit_rate;
if (!q->nb_channels) {
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
return AVERROR_INVALIDDATA;
}
/* Initialize RNG. */
av_lfg_init(&q->random_state, 0);
@@ -1205,6 +1236,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->subpacket[s].gains2.now = q->subpacket[s].gain_3;
q->subpacket[s].gains2.previous = q->subpacket[s].gain_4;
if (q->num_subpackets + q->subpacket[s].num_channels > q->nb_channels) {
av_log(avctx, AV_LOG_ERROR, "Too many subpackets %d for channels %d\n", q->num_subpackets, q->nb_channels);
return AVERROR_INVALIDDATA;
}
q->num_subpackets++;
s++;
if (s > MAX_SUBPACKETS) {

View File

@@ -36,8 +36,8 @@ static const int expbits_tab[8] = {
52,47,43,37,29,22,16,0,
};
static const float dither_tab[8] = {
0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107,
static const float dither_tab[9] = {
0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107, 1.0
};
static const float quant_centroid_tab[7][14] = {
@@ -510,23 +510,37 @@ static const int cplband[51] = {
19,
};
static const float cplscale2[3] = {
// The 1 and 0 at the beginning/end are to prevent overflows with
// bitstream-read indexes. E.g. if n_bits=5, we can access any
// index from [1, (1<<n_bits)] for the first decoupling coeff,
// and (1<<n_bits)-coeff1 as index for coeff2, i.e.:
// coeff1_idx = [1, 32], and coeff2_idx = [0, 31].
// These values aren't part of the tables in the original binary.
static const float cplscale2[5] = {
1,
0.953020632266998,0.70710676908493,0.302905440330505,
0,
};
static const float cplscale3[7] = {
static const float cplscale3[9] = {
1,
0.981279790401459,0.936997592449188,0.875934481620789,0.70710676908493,
0.482430040836334,0.349335819482803,0.192587479948997,
0,
};
static const float cplscale4[15] = {
static const float cplscale4[17] = {
1,
0.991486728191376,0.973249018192291,0.953020632266998,0.930133521556854,
0.903453230857849,0.870746195316315,0.826180458068848,0.70710676908493,
0.563405573368073,0.491732746362686,0.428686618804932,0.367221474647522,
0.302905440330505,0.229752898216248,0.130207896232605,
0,
};
static const float cplscale5[31] = {
static const float cplscale5[33] = {
1,
0.995926380157471,0.987517595291138,0.978726446628571,0.969505727291107,
0.95979779958725,0.949531257152557,0.938616216182709,0.926936149597168,
0.914336204528809,0.900602877140045,0.885426938533783,0.868331849575043,
@@ -535,9 +549,11 @@ static const float cplscale5[31] = {
0.464778542518616,0.434642940759659,0.404955863952637,0.375219136476517,
0.344963222742081,0.313672333955765,0.280692428350449,0.245068684220314,
0.205169528722763,0.157508864998817,0.0901700109243393,
0,
};
static const float cplscale6[63] = {
static const float cplscale6[65] = {
1,
0.998005926609039,0.993956744670868,0.989822506904602,0.985598564147949,
0.981279790401459,0.976860702037811,0.972335040569305,0.967696130275726,
0.962936460971832,0.958047747612000,0.953020632266998,0.947844684123993,
@@ -554,6 +570,7 @@ static const float cplscale6[63] = {
0.302905440330505,0.286608695983887,0.269728302955627,0.252119421958923,
0.233590632677078,0.213876649737358,0.192587479948997,0.169101938605309,
0.142307326197624,0.109772264957428,0.0631198287010193,
0,
};
static const float* const cplscales[5] = {

View File

@@ -228,7 +228,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
av_log(avctx, AV_LOG_ERROR,
"CamStudio codec error: invalid depth %i bpp\n",
avctx->bits_per_coded_sample);
return 1;
return AVERROR_INVALIDDATA;
}
c->bpp = avctx->bits_per_coded_sample;
avcodec_get_frame_defaults(&c->pic);
@@ -242,7 +242,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING);
if (!c->decomp_buf) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return 1;
return AVERROR(ENOMEM);
}
return 0;
}

View File

@@ -29,8 +29,10 @@
#include "libavutil/common.h"
#include "libavutil/intmath.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "internal.h"
#include "dsputil.h"
#include "fft.h"
#include "get_bits.h"
@@ -576,6 +578,11 @@ static int dca_parse_frame_header(DCAContext *s)
s->lfe = get_bits(&s->gb, 2);
s->predictor_history = get_bits(&s->gb, 1);
if (s->lfe > 2) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid LFE value: %d\n", s->lfe);
return AVERROR_INVALIDDATA;
}
/* TODO: check CRC */
if (s->crc_present)
s->header_crc = get_bits(&s->gb, 16);
@@ -638,13 +645,20 @@ static int dca_parse_frame_header(DCAContext *s)
}
static inline int get_scale(GetBitContext *gb, int level, int value)
static inline int get_scale(GetBitContext *gb, int level, int value, int log2range)
{
if (level < 5) {
/* huffman encoded */
value += get_bitalloc(gb, &dca_scalefactor, level);
} else if (level < 8)
value = get_bits(gb, level + 1);
value = av_clip(value, 0, (1 << log2range) - 1);
} else if (level < 8) {
if (level + 1 > log2range) {
skip_bits(gb, level + 1 - log2range);
value = get_bits(gb, log2range);
} else {
value = get_bits(gb, level + 1);
}
}
return value;
}
@@ -717,28 +731,31 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
for (j = base_channel; j < s->prim_channels; j++) {
const uint32_t *scale_table;
int scale_sum;
int scale_sum, log_size;
memset(s->scale_factor[j], 0,
s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2);
if (s->scalefactor_huffman[j] == 6)
if (s->scalefactor_huffman[j] == 6) {
scale_table = scale_factor_quant7;
else
log_size = 7;
} else {
scale_table = scale_factor_quant6;
log_size = 6;
}
/* When huffman coded, only the difference is encoded */
scale_sum = 0;
for (k = 0; k < s->subband_activity[j]; k++) {
if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) {
scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum);
scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
s->scale_factor[j][k][0] = scale_table[scale_sum];
}
if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) {
/* Get second scale factor */
scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum);
scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
s->scale_factor[j][k][1] = scale_table[scale_sum];
}
}
@@ -767,8 +784,7 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
* (is this valid as well for joint scales ???) */
for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
scale = get_scale(&s->gb, s->joint_huff[j], 0);
scale += 64; /* bias */
scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7);
s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */
}
@@ -789,6 +805,18 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
}
} else {
int am = s->amode & DCA_CHANNEL_MASK;
if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid channel mode %d\n", am);
return AVERROR_INVALIDDATA;
}
if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
av_log_ask_for_sample(s->avctx, "Downmixing %d channels",
s->prim_channels);
return AVERROR_PATCHWELCOME;
}
for (j = base_channel; j < s->prim_channels; j++) {
s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
@@ -828,7 +856,8 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
}
/* Scale factor index */
s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 8)];
skip_bits(&s->gb, 1);
s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 7)];
/* Quantization step size * scale factor */
lfe_scale = 0.035 * s->lfe_scale_factor;
@@ -1237,6 +1266,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
#endif
} else {
av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
return AVERROR_INVALIDDATA;
}
}
@@ -1866,7 +1896,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = 256 * (s->sample_blocks / 8);
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}

View File

@@ -7528,7 +7528,7 @@ static const float dca_downmix_coeffs[65] = {
0.001412537544623, 0.001000000000000, 0.000501187233627, 0.000251188643151, 0.000000000000000,
};
static const uint8_t dca_default_coeffs[16][5][2] = {
static const uint8_t dca_default_coeffs[10][5][2] = {
{ { 13, 13 }, },
{ { 0, 64 }, { 64, 0 }, },
{ { 0, 64 }, { 64, 0 }, },

View File

@@ -234,8 +234,10 @@ static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng, in
break;
case 1:
j = av_lfg_get(prng) % 10 + 1;
for (i = 0; i < j; i++)
block[av_lfg_get(prng) % 64] = av_lfg_get(prng) % (2*vals) -vals;
for (i = 0; i < j; i++) {
int idx = av_lfg_get(prng) % 64;
block[idx] = av_lfg_get(prng) % (2*vals) -vals;
}
break;
case 2:
block[ 0] = av_lfg_get(prng) % (16*vals) - (8*vals);

View File

@@ -21,8 +21,10 @@
*/
#include "avcodec.h"
#include "libavutil/intreadwrite.h"
#include "internal.h"
#include "bytestream.h"
#include "libavutil/imgutils.h"
#include "libavutil/lzo.h" // for av_memcpy_backptr
typedef struct DfaContext {
@@ -35,9 +37,13 @@ typedef struct DfaContext {
static av_cold int dfa_decode_init(AVCodecContext *avctx)
{
DfaContext *s = avctx->priv_data;
int ret;
avctx->pix_fmt = PIX_FMT_PAL8;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
s->frame_buf = av_mallocz(avctx->width * avctx->height + AV_LZO_OUTPUT_PADDING);
if (!s->frame_buf)
return AVERROR(ENOMEM);
@@ -45,19 +51,16 @@ static av_cold int dfa_decode_init(AVCodecContext *avctx)
return 0;
}
static int decode_copy(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_copy(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const int size = width * height;
if (src_end - src < size)
return -1;
bytestream_get_buffer(&src, frame, size);
if (bytestream2_get_buffer(gb, frame, size) != size)
return AVERROR_INVALIDDATA;
return 0;
}
static int decode_tsw1(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
@@ -65,31 +68,31 @@ static int decode_tsw1(uint8_t *frame, int width, int height,
int v, count, segments;
unsigned offset;
segments = bytestream_get_le32(&src);
offset = bytestream_get_le32(&src);
segments = bytestream2_get_le32(gb);
offset = bytestream2_get_le32(gb);
if (frame_end - frame <= offset)
return -1;
return AVERROR_INVALIDDATA;
frame += offset;
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
if (mask == 0x10000) {
if (src >= src_end)
return -1;
bitbuf = bytestream_get_le16(&src);
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (src_end - src < 2 || frame_end - frame < 2)
return -1;
if (frame_end - frame < 2)
return AVERROR_INVALIDDATA;
if (bitbuf & mask) {
v = bytestream_get_le16(&src);
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 1;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count)
return -1;
return AVERROR_INVALIDDATA;
av_memcpy_backptr(frame, offset, count);
frame += count;
} else {
*frame++ = *src++;
*frame++ = *src++;
*frame++ = bytestream2_get_byte(gb);
*frame++ = bytestream2_get_byte(gb);
}
mask <<= 1;
}
@@ -97,39 +100,38 @@ static int decode_tsw1(uint8_t *frame, int width, int height,
return 0;
}
static int decode_dsw1(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
int mask = 0x10000, bitbuf = 0;
int v, offset, count, segments;
segments = bytestream_get_le16(&src);
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
if (mask == 0x10000) {
if (src >= src_end)
return -1;
bitbuf = bytestream_get_le16(&src);
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (src_end - src < 2 || frame_end - frame < 2)
return -1;
if (frame_end - frame < 2)
return AVERROR_INVALIDDATA;
if (bitbuf & mask) {
v = bytestream_get_le16(&src);
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 1;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count)
return -1;
return AVERROR_INVALIDDATA;
// can't use av_memcpy_backptr() since it can overwrite following pixels
for (v = 0; v < count; v++)
frame[v] = frame[v - offset];
frame += count;
} else if (bitbuf & (mask << 1)) {
frame += bytestream_get_le16(&src);
frame += bytestream2_get_le16(gb);
} else {
*frame++ = *src++;
*frame++ = *src++;
*frame++ = bytestream2_get_byte(gb);
*frame++ = bytestream2_get_byte(gb);
}
mask <<= 2;
}
@@ -137,30 +139,28 @@ static int decode_dsw1(uint8_t *frame, int width, int height,
return 0;
}
static int decode_dds1(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
int mask = 0x10000, bitbuf = 0;
int i, v, offset, count, segments;
segments = bytestream_get_le16(&src);
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
if (mask == 0x10000) {
if (src >= src_end)
return -1;
bitbuf = bytestream_get_le16(&src);
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (src_end - src < 2 || frame_end - frame < 2)
return -1;
if (bitbuf & mask) {
v = bytestream_get_le16(&src);
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 2;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count*2 + width)
return -1;
return AVERROR_INVALIDDATA;
for (i = 0; i < count; i++) {
frame[0] = frame[1] =
frame[width] = frame[width + 1] = frame[-offset];
@@ -168,13 +168,18 @@ static int decode_dds1(uint8_t *frame, int width, int height,
frame += 2;
}
} else if (bitbuf & (mask << 1)) {
frame += bytestream_get_le16(&src) * 2;
v = bytestream2_get_le16(gb)*2;
if (frame - frame_end < v)
return AVERROR_INVALIDDATA;
frame += v;
} else {
if (frame_end - frame < width + 3)
return AVERROR_INVALIDDATA;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = *src++;
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
frame[0] = frame[1] =
frame[width] = frame[width + 1] = *src++;
frame[width] = frame[width + 1] = bytestream2_get_byte(gb);
frame += 2;
}
mask <<= 2;
@@ -183,40 +188,40 @@ static int decode_dds1(uint8_t *frame, int width, int height,
return 0;
}
static int decode_bdlt(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_bdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
{
uint8_t *line_ptr;
int count, lines, segments;
count = bytestream_get_le16(&src);
count = bytestream2_get_le16(gb);
if (count >= height)
return -1;
return AVERROR_INVALIDDATA;
frame += width * count;
lines = bytestream_get_le16(&src);
if (count + lines > height || src >= src_end)
return -1;
lines = bytestream2_get_le16(gb);
if (count + lines > height)
return AVERROR_INVALIDDATA;
while (lines--) {
if (bytestream2_get_bytes_left(gb) < 1)
return AVERROR_INVALIDDATA;
line_ptr = frame;
frame += width;
segments = *src++;
segments = bytestream2_get_byteu(gb);
while (segments--) {
if (src_end - src < 3)
return -1;
if (frame - line_ptr <= *src)
return -1;
line_ptr += *src++;
count = (int8_t)*src++;
if (frame - line_ptr <= bytestream2_peek_byte(gb))
return AVERROR_INVALIDDATA;
line_ptr += bytestream2_get_byte(gb);
count = (int8_t)bytestream2_get_byte(gb);
if (count >= 0) {
if (frame - line_ptr < count || src_end - src < count)
return -1;
bytestream_get_buffer(&src, line_ptr, count);
if (frame - line_ptr < count)
return AVERROR_INVALIDDATA;
if (bytestream2_get_buffer(gb, line_ptr, count) != count)
return AVERROR_INVALIDDATA;
} else {
count = -count;
if (frame - line_ptr < count || src >= src_end)
return -1;
memset(line_ptr, *src++, count);
if (frame - line_ptr < count)
return AVERROR_INVALIDDATA;
memset(line_ptr, bytestream2_get_byte(gb), count);
}
line_ptr += count;
}
@@ -225,49 +230,55 @@ static int decode_bdlt(uint8_t *frame, int width, int height,
return 0;
}
static int decode_wdlt(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_end = frame + width * height;
uint8_t *line_ptr;
int count, i, v, lines, segments;
int y = 0;
lines = bytestream_get_le16(&src);
if (lines > height || src >= src_end)
return -1;
lines = bytestream2_get_le16(gb);
if (lines > height)
return AVERROR_INVALIDDATA;
while (lines--) {
segments = bytestream_get_le16(&src);
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
segments = bytestream2_get_le16u(gb);
while ((segments & 0xC000) == 0xC000) {
unsigned skip_lines = -(int16_t)segments;
unsigned delta = -((int16_t)segments * width);
if (frame_end - frame <= delta)
return -1;
if (frame_end - frame <= delta || y + lines + skip_lines > height)
return AVERROR_INVALIDDATA;
frame += delta;
segments = bytestream_get_le16(&src);
y += skip_lines;
segments = bytestream2_get_le16(gb);
}
if (segments & 0x8000) {
frame[width - 1] = segments & 0xFF;
segments = bytestream_get_le16(&src);
segments = bytestream2_get_le16(gb);
}
line_ptr = frame;
if (frame_end - frame < width)
return AVERROR_INVALIDDATA;
frame += width;
y++;
while (segments--) {
if (src_end - src < 2)
return -1;
if (frame - line_ptr <= *src)
return -1;
line_ptr += *src++;
count = (int8_t)*src++;
if (frame - line_ptr <= bytestream2_peek_byte(gb))
return AVERROR_INVALIDDATA;
line_ptr += bytestream2_get_byte(gb);
count = (int8_t)bytestream2_get_byte(gb);
if (count >= 0) {
if (frame - line_ptr < count*2 || src_end - src < count*2)
return -1;
bytestream_get_buffer(&src, line_ptr, count*2);
if (frame - line_ptr < count * 2)
return AVERROR_INVALIDDATA;
if (bytestream2_get_buffer(gb, line_ptr, count * 2) != count * 2)
return AVERROR_INVALIDDATA;
line_ptr += count * 2;
} else {
count = -count;
if (frame - line_ptr < count*2 || src_end - src < 2)
return -1;
v = bytestream_get_le16(&src);
if (frame - line_ptr < count * 2)
return AVERROR_INVALIDDATA;
v = bytestream2_get_le16(gb);
for (i = 0; i < count; i++)
bytestream_put_le16(&line_ptr, v);
}
@@ -277,22 +288,19 @@ static int decode_wdlt(uint8_t *frame, int width, int height,
return 0;
}
static int decode_unk6(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_unk6(GetByteContext *gb, uint8_t *frame, int width, int height)
{
return -1;
return AVERROR_PATCHWELCOME;
}
static int decode_blck(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end)
static int decode_blck(GetByteContext *gb, uint8_t *frame, int width, int height)
{
memset(frame, 0, width * height);
return 0;
}
typedef int (*chunk_decoder)(uint8_t *frame, int width, int height,
const uint8_t *src, const uint8_t *src_end);
typedef int (*chunk_decoder)(GetByteContext *gb, uint8_t *frame, int width, int height);
static const chunk_decoder decoder[8] = {
decode_copy, decode_tsw1, decode_bdlt, decode_wdlt,
@@ -308,9 +316,8 @@ static int dfa_decode_frame(AVCodecContext *avctx,
AVPacket *avpkt)
{
DfaContext *s = avctx->priv_data;
GetByteContext gb;
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = avpkt->data + avpkt->size;
const uint8_t *tmp_buf;
uint32_t chunk_type, chunk_size;
uint8_t *dst;
int ret;
@@ -319,35 +326,30 @@ static int dfa_decode_frame(AVCodecContext *avctx,
if (s->pic.data[0])
avctx->release_buffer(avctx, &s->pic);
if ((ret = avctx->get_buffer(avctx, &s->pic))) {
if ((ret = ff_get_buffer(avctx, &s->pic))) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
while (buf < buf_end) {
chunk_size = AV_RL32(buf + 4);
chunk_type = AV_RL32(buf + 8);
buf += 12;
if (buf_end - buf < chunk_size) {
av_log(avctx, AV_LOG_ERROR, "Chunk size is too big (%d bytes)\n", chunk_size);
return -1;
}
bytestream2_init(&gb, avpkt->data, avpkt->size);
while (bytestream2_get_bytes_left(&gb) > 0) {
bytestream2_skip(&gb, 4);
chunk_size = bytestream2_get_le32(&gb);
chunk_type = bytestream2_get_le32(&gb);
if (!chunk_type)
break;
if (chunk_type == 1) {
pal_elems = FFMIN(chunk_size / 3, 256);
tmp_buf = buf;
for (i = 0; i < pal_elems; i++) {
s->pal[i] = bytestream_get_be24(&tmp_buf) << 2;
s->pal[i] = bytestream2_get_be24(&gb) << 2;
s->pal[i] |= 0xFF << 24 | (s->pal[i] >> 6) & 0x30303;
}
s->pic.palette_has_changed = 1;
} else if (chunk_type <= 9) {
if (decoder[chunk_type - 2](s->frame_buf, avctx->width, avctx->height,
buf, buf + chunk_size)) {
if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) {
av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n",
chunk_name[chunk_type - 2]);
return -1;
return AVERROR_INVALIDDATA;
}
} else {
av_log(avctx, AV_LOG_WARNING, "Ignoring unknown chunk type %d\n",

View File

@@ -491,10 +491,16 @@ static inline void codeblock(DiracContext *s, SubBand *b,
}
if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) {
int quant = b->quant;
if (is_arith)
b->quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA);
else
b->quant += dirac_get_se_golomb(gb);
quant += dirac_get_se_golomb(gb);
if (quant < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n");
return;
}
b->quant = quant;
}
b->quant = FFMIN(b->quant, MAX_QUANT);
@@ -619,7 +625,7 @@ static void decode_component(DiracContext *s, int comp)
b->quant = svq3_get_ue_golomb(&s->gb);
align_get_bits(&s->gb);
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
b->length = FFMIN(b->length, get_bits_left(&s->gb)/8);
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0));
skip_bits_long(&s->gb, b->length*8);
}
}
@@ -1172,7 +1178,7 @@ static void propagate_block_data(DiracBlock *block, int stride, int size)
* Dirac Specification ->
* 12. Block motion data syntax
*/
static void dirac_unpack_block_motion_data(DiracContext *s)
static int dirac_unpack_block_motion_data(DiracContext *s)
{
GetBitContext *gb = &s->gb;
uint8_t *sbsplit = s->sbsplit;
@@ -1192,7 +1198,9 @@ static void dirac_unpack_block_motion_data(DiracContext *s)
ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); /* svq3_get_ue_golomb(gb) is the length */
for (y = 0; y < s->sbheight; y++) {
for (x = 0; x < s->sbwidth; x++) {
int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);
unsigned int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);
if (split > 2)
return -1;
sbsplit[x] = (split + pred_sbsplit(sbsplit+x, s->sbwidth, x, y)) % 3;
}
sbsplit += s->sbwidth;
@@ -1221,6 +1229,8 @@ static void dirac_unpack_block_motion_data(DiracContext *s)
propagate_block_data(block, s->blwidth, step);
}
}
return 0;
}
static int weight(int i, int blen, int offset)
@@ -1322,8 +1332,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5],
motion_y >>= s->chroma_y_shift;
}
mx = motion_x & ~(-1 << s->mv_precision);
my = motion_y & ~(-1 << s->mv_precision);
mx = motion_x & ~(-1U << s->mv_precision);
my = motion_y & ~(-1U << s->mv_precision);
motion_x >>= s->mv_precision;
motion_y >>= s->mv_precision;
/* normalize subpel coordinates to epel */
@@ -1675,7 +1685,8 @@ static int dirac_decode_picture_header(DiracContext *s)
if (s->num_refs) {
if (dirac_unpack_prediction_parameters(s)) /* [DIRAC_STD] 11.2 Picture Prediction Data. picture_prediction() */
return -1;
dirac_unpack_block_motion_data(s); /* [DIRAC_STD] 12. Block motion data syntax */
if (dirac_unpack_block_motion_data(s)) /* [DIRAC_STD] 12. Block motion data syntax */
return -1;
}
if (dirac_unpack_idwt_params(s)) /* [DIRAC_STD] 11.3 Wavelet transform data */
return -1;

View File

@@ -1038,7 +1038,7 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
if (cid->width == avctx->width && cid->height == avctx->height &&
cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
cid->bit_depth == bit_depth) {
for (j = 0; j < sizeof(cid->bit_rates); j++) {
for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
if (cid->bit_rates[j] == mbs)
return cid->cid;
}

View File

@@ -38,6 +38,7 @@ typedef struct DNXHDContext {
GetBitContext gb;
int cid; ///< compression id
unsigned int width, height;
enum PixelFormat pix_fmt;
unsigned int mb_width, mb_height;
uint32_t mb_scan_index[68]; /* max for 1080p */
int cur_field; ///< current interlaced field
@@ -84,9 +85,9 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
}
ctx->cid_table = &ff_dnxhd_cid_table[index];
free_vlc(&ctx->ac_vlc);
free_vlc(&ctx->dc_vlc);
free_vlc(&ctx->run_vlc);
ff_free_vlc(&ctx->ac_vlc);
ff_free_vlc(&ctx->dc_vlc);
ff_free_vlc(&ctx->run_vlc);
init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
ctx->cid_table->ac_bits, 1, 1,
@@ -129,7 +130,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
if (buf[0x21] & 0x40) {
ctx->avctx->pix_fmt = PIX_FMT_YUV422P10;
ctx->pix_fmt = PIX_FMT_YUV422P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
dsputil_init(&ctx->dsp, ctx->avctx);
@@ -137,7 +138,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
}
} else {
ctx->avctx->pix_fmt = PIX_FMT_YUV422P;
ctx->pix_fmt = PIX_FMT_YUV422P;
ctx->avctx->bits_per_raw_sample = 8;
if (ctx->bit_depth != 8) {
dsputil_init(&ctx->dsp, ctx->avctx);
@@ -380,9 +381,15 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
avctx->width, avctx->height, ctx->width, ctx->height);
first_field = 1;
}
if (avctx->pix_fmt != PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));
first_field = 1;
}
if (av_image_check_size(ctx->width, ctx->height, 0, avctx))
return -1;
avctx->pix_fmt = ctx->pix_fmt;
avcodec_set_dimensions(avctx, ctx->width, ctx->height);
if (first_field) {
@@ -416,9 +423,9 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
if (ctx->picture.data[0])
ff_thread_release_buffer(avctx, &ctx->picture);
free_vlc(&ctx->ac_vlc);
free_vlc(&ctx->dc_vlc);
free_vlc(&ctx->run_vlc);
ff_free_vlc(&ctx->ac_vlc);
ff_free_vlc(&ctx->dc_vlc);
ff_free_vlc(&ctx->run_vlc);
return 0;
}

View File

@@ -220,7 +220,7 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
static int dnxhd_init_rc(DNXHDEncContext *ctx)
{
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);

View File

@@ -39,6 +39,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
typedef struct DPCMContext {
@@ -183,6 +184,11 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
int stereo = s->channels - 1;
int16_t *output_samples;
if (stereo && (buf_size & 1)) {
buf_size--;
buf_end--;
}
/* calculate output size */
switch(avctx->codec->id) {
case CODEC_ID_ROQ_DPCM:
@@ -211,7 +217,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = (out + s->channels - 1) / s->channels;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -320,7 +326,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
return buf_size;
return avpkt->size;
}
#define DPCM_DECODER(id_, name_, long_name_) \

View File

@@ -25,6 +25,7 @@
*/
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
#include "mathops.h"
@@ -108,27 +109,31 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
return 0;
}
static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst, int size)
static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst,
int size)
{
while (size--)
*dst++ += *src++;
}
static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
static int cin_decode_huffman(const unsigned char *src, int src_size,
unsigned char *dst, int dst_size)
{
int b, huff_code = 0;
unsigned char huff_code_table[15];
unsigned char *dst_cur = dst;
unsigned char *dst_end = dst + dst_size;
unsigned char *dst_cur = dst;
unsigned char *dst_end = dst + dst_size;
const unsigned char *src_end = src + src_size;
memcpy(huff_code_table, src, 15); src += 15; src_size -= 15;
memcpy(huff_code_table, src, 15);
src += 15;
src_size -= 15;
while (src < src_end) {
huff_code = *src++;
if ((huff_code >> 4) == 15) {
b = huff_code << 4;
huff_code = *src++;
b = huff_code << 4;
huff_code = *src++;
*dst_cur++ = b | (huff_code >> 4);
} else
*dst_cur++ = huff_code_table[huff_code >> 4];
@@ -147,11 +152,12 @@ static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned c
return dst_cur - dst;
}
static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
static int cin_decode_lzss(const unsigned char *src, int src_size,
unsigned char *dst, int dst_size)
{
uint16_t cmd;
int i, sz, offset, code;
unsigned char *dst_end = dst + dst_size;
unsigned char *dst_end = dst + dst_size, *dst_start = dst;
const unsigned char *src_end = src + src_size;
while (src < src_end && dst < dst_end) {
@@ -160,11 +166,15 @@ static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned cha
if (code & (1 << i)) {
*dst++ = *src++;
} else {
cmd = AV_RL16(src); src += 2;
cmd = AV_RL16(src);
src += 2;
offset = cmd >> 4;
if ((int)(dst - dst_start) < offset + 1)
return AVERROR_INVALIDDATA;
sz = (cmd & 0xF) + 2;
/* don't use memcpy/memmove here as the decoding routine (ab)uses */
/* buffer overlappings to repeat bytes in the destination */
/* don't use memcpy/memmove here as the decoding routine
* (ab)uses buffer overlappings to repeat bytes in the
* destination */
sz = FFMIN(sz, dst_end - dst);
while (sz--) {
*dst = *(dst - offset - 1);
@@ -173,22 +183,27 @@ static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned cha
}
}
}
return 0;
}
static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
static void cin_decode_rle(const unsigned char *src, int src_size,
unsigned char *dst, int dst_size)
{
int len, code;
unsigned char *dst_end = dst + dst_size;
unsigned char *dst_end = dst + dst_size;
const unsigned char *src_end = src + src_size;
while (src < src_end && dst < dst_end) {
code = *src++;
if (code & 0x80) {
if (src >= src_end)
break;
len = code - 0x7F;
memset(dst, *src++, FFMIN(len, dst_end - dst));
} else {
len = code + 1;
memcpy(dst, src, FFMIN(len, dst_end - dst));
memcpy(dst, src, FFMIN3(len, dst_end - dst, src_end - src));
src += len;
}
dst += len;
@@ -199,21 +214,16 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
CinVideoContext *cin = avctx->priv_data;
int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size;
int i, y, palette_type, palette_colors_count,
bitmap_frame_type, bitmap_frame_size, res = 0;
cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &cin->frame)) {
av_log(cin->avctx, AV_LOG_ERROR, "delphinecinvideo: reget_buffer() failed to allocate a frame\n");
return -1;
}
palette_type = buf[0];
palette_type = buf[0];
palette_colors_count = AV_RL16(buf+1);
bitmap_frame_type = buf[3];
buf += 4;
bitmap_frame_type = buf[3];
buf += 4;
bitmap_frame_size = buf_size - 4;
@@ -224,67 +234,85 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
if (palette_colors_count > 256)
return AVERROR_INVALIDDATA;
for (i = 0; i < palette_colors_count; ++i) {
cin->palette[i] = 0xFF << 24 | bytestream_get_le24(&buf);
cin->palette[i] = 0xFF << 24 | bytestream_get_le24(&buf);
bitmap_frame_size -= 3;
}
} else {
for (i = 0; i < palette_colors_count; ++i) {
cin->palette[buf[0]] = 0xFF << 24 | AV_RL24(buf+1);
buf += 4;
bitmap_frame_size -= 4;
cin->palette[buf[0]] = 0xFF << 24 | AV_RL24(buf + 1);
buf += 4;
bitmap_frame_size -= 4;
}
}
memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette));
cin->frame.palette_has_changed = 1;
/* note: the decoding routines below assumes that surface.width = surface.pitch */
bitmap_frame_size = FFMIN(cin->bitmap_size, bitmap_frame_size);
/* note: the decoding routines below assumes that
* surface.width = surface.pitch */
switch (bitmap_frame_type) {
case 9:
cin_decode_rle(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 34:
cin_decode_rle(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 35:
cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 36:
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_INT_BMP],
cin->bitmap_size);
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 37:
cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 38:
cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
res = cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP],
cin->bitmap_size);
if (res < 0)
return res;
break;
case 39:
cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
res = cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP],
cin->bitmap_size);
if (res < 0)
return res;
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
}
cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if ((res = avctx->reget_buffer(avctx, &cin->frame)) < 0) {
av_log(cin->avctx, AV_LOG_ERROR,
"delphinecinvideo: reget_buffer() failed to allocate a frame\n");
return res;
}
memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette));
cin->frame.palette_has_changed = 1;
for (y = 0; y < cin->avctx->height; ++y)
memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0],
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
cin->avctx->width);
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
cin->avctx->width);
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP],
cin->bitmap_table[CIN_PRE_BMP]);
*data_size = sizeof(AVFrame);
*(AVFrame *)data = cin->frame;
@@ -328,15 +356,15 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
CinAudioContext *cin = avctx->priv_data;
const uint8_t *buf = avpkt->data;
CinAudioContext *cin = avctx->priv_data;
const uint8_t *buf_end = buf + avpkt->size;
int16_t *samples;
int delta, ret;
/* get output buffer */
cin->frame.nb_samples = avpkt->size - cin->initial_decode_frame;
if ((ret = avctx->get_buffer(avctx, &cin->frame)) < 0) {
if ((ret = ff_get_buffer(avctx, &cin->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -345,13 +373,13 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
delta = cin->delta;
if (cin->initial_decode_frame) {
cin->initial_decode_frame = 0;
delta = sign_extend(AV_RL16(buf), 16);
buf += 2;
*samples++ = delta;
delta = sign_extend(AV_RL16(buf), 16);
buf += 2;
*samples++ = delta;
}
while (buf < buf_end) {
delta += cinaudio_delta16_table[*buf++];
delta = av_clip_int16(delta);
delta += cinaudio_delta16_table[*buf++];
delta = av_clip_int16(delta);
*samples++ = delta;
}
cin->delta = delta;

View File

@@ -367,18 +367,17 @@ void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<8;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
pixels[2] = cm[block[2]];
pixels[3] = cm[block[3]];
pixels[4] = cm[block[4]];
pixels[5] = cm[block[5]];
pixels[6] = cm[block[6]];
pixels[7] = cm[block[7]];
pixels[0] = av_clip_uint8(block[0]);
pixels[1] = av_clip_uint8(block[1]);
pixels[2] = av_clip_uint8(block[2]);
pixels[3] = av_clip_uint8(block[3]);
pixels[4] = av_clip_uint8(block[4]);
pixels[5] = av_clip_uint8(block[5]);
pixels[6] = av_clip_uint8(block[6]);
pixels[7] = av_clip_uint8(block[7]);
pixels += line_size;
block += 8;
@@ -389,14 +388,13 @@ static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<4;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
pixels[2] = cm[block[2]];
pixels[3] = cm[block[3]];
pixels[0] = av_clip_uint8(block[0]);
pixels[1] = av_clip_uint8(block[1]);
pixels[2] = av_clip_uint8(block[2]);
pixels[3] = av_clip_uint8(block[3]);
pixels += line_size;
block += 8;
@@ -407,12 +405,11 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<2;i++) {
pixels[0] = cm[block[0]];
pixels[1] = cm[block[1]];
pixels[0] = av_clip_uint8(block[0]);
pixels[1] = av_clip_uint8(block[1]);
pixels += line_size;
block += 8;
@@ -444,18 +441,17 @@ void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<8;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels[2] = cm[pixels[2] + block[2]];
pixels[3] = cm[pixels[3] + block[3]];
pixels[4] = cm[pixels[4] + block[4]];
pixels[5] = cm[pixels[5] + block[5]];
pixels[6] = cm[pixels[6] + block[6]];
pixels[7] = cm[pixels[7] + block[7]];
pixels[0] = av_clip_uint8(pixels[0] + block[0]);
pixels[1] = av_clip_uint8(pixels[1] + block[1]);
pixels[2] = av_clip_uint8(pixels[2] + block[2]);
pixels[3] = av_clip_uint8(pixels[3] + block[3]);
pixels[4] = av_clip_uint8(pixels[4] + block[4]);
pixels[5] = av_clip_uint8(pixels[5] + block[5]);
pixels[6] = av_clip_uint8(pixels[6] + block[6]);
pixels[7] = av_clip_uint8(pixels[7] + block[7]);
pixels += line_size;
block += 8;
}
@@ -465,14 +461,13 @@ static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<4;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels[2] = cm[pixels[2] + block[2]];
pixels[3] = cm[pixels[3] + block[3]];
pixels[0] = av_clip_uint8(pixels[0] + block[0]);
pixels[1] = av_clip_uint8(pixels[1] + block[1]);
pixels[2] = av_clip_uint8(pixels[2] + block[2]);
pixels[3] = av_clip_uint8(pixels[3] + block[3]);
pixels += line_size;
block += 8;
}
@@ -482,12 +477,11 @@ static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels
int line_size)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
/* read the pixels */
for(i=0;i<2;i++) {
pixels[0] = cm[pixels[0] + block[0]];
pixels[1] = cm[pixels[1] + block[1]];
pixels[0] = av_clip_uint8(pixels[0] + block[0]);
pixels[1] = av_clip_uint8(pixels[1] + block[1]);
pixels += line_size;
block += 8;
}
@@ -1918,7 +1912,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
long i;
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
long a = *(long*)(src+i);
long b = *(long*)(dst+i);
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
@@ -1943,7 +1937,7 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
}
}else
#endif
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) {
long a = *(long*)(src1+i);
long b = *(long*)(src2+i);
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
@@ -2779,15 +2773,11 @@ static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block)
static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dest[0] = cm[(block[0] + 4)>>3];
dest[0] = av_clip_uint8((block[0] + 4)>>3);
}
static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
dest[0] = cm[dest[0] + ((block[0] + 4)>>3)];
dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3));
}
static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }
@@ -2832,7 +2822,7 @@ int ff_check_alignment(void){
av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i;
int i, j;
ff_check_alignment();
@@ -3194,11 +3184,15 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
if (ARCH_SH4) dsputil_init_sh4 (c, avctx);
if (ARCH_BFIN) dsputil_init_bfin (c, avctx);
for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
for (i = 0; i < 4; i++) {
for (j = 0; j < 16; j++) {
if(!c->put_2tap_qpel_pixels_tab[i][j])
c->put_2tap_qpel_pixels_tab[i][j] =
c->put_h264_qpel_pixels_tab[i][j];
if(!c->avg_2tap_qpel_pixels_tab[i][j])
c->avg_2tap_qpel_pixels_tab[i][j] =
c->avg_h264_qpel_pixels_tab[i][j];
}
}
ff_init_scantable_permutation(c->idct_permutation,

View File

@@ -33,6 +33,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
typedef int emuedge_linesize_type;
//#define DEBUG
/* dct code */

View File

@@ -312,7 +312,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx)
dv_rl_vlc[i].level = level;
dv_rl_vlc[i].run = run;
}
free_vlc(&dv_vlc);
ff_free_vlc(&dv_vlc);
dv_vlc_map_tableinit();
}
@@ -372,11 +372,6 @@ typedef struct BlockInfo {
static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
static inline int put_bits_left(PutBitContext* s)
{
return (s->buf_end - s->buf) * 8 - put_bits_count(s);
}
/* decode AC coefficients */
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
{

View File

@@ -94,6 +94,12 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
int x, y, len, color;
uint8_t *d;
if (start >= buf_size)
return -1;
if (w <= 0 || h <= 0)
return -1;
bit_len = (buf_size - start) * 8;
init_get_bits(&gb, buf + start, bit_len);
@@ -336,10 +342,12 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
sub_header->num_rects = 1;
sub_header->rects[0]->pict.data[0] = bitmap;
decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit);
decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit);
if (decode_rle(bitmap, w * 2, w, (h + 1) / 2,
buf, offset1, buf_size, is_8bit) < 0)
goto fail;
if (decode_rle(bitmap + w, w * 2, w, h / 2,
buf, offset2, buf_size, is_8bit) < 0)
goto fail;
sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (is_8bit) {
if (yuv_palette == 0)

View File

@@ -255,6 +255,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
case 5:
c->pic.key_frame = !(compr & 1);
c->pic.pict_type = (compr & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
if (!tmpptr && !c->pic.key_frame) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
return AVERROR_INVALIDDATA;
}
for(j = 0; j < avctx->height; j++){
if(compr & 1){
for(i = 0; i < avctx->width; i++)
@@ -295,6 +301,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (avctx->width%4 || avctx->height%4) {
av_log(avctx, AV_LOG_ERROR, "dimensions are not a multiple of 4");
return AVERROR_INVALIDDATA;
}
avcodec_get_frame_defaults(&c->pic);
avcodec_get_frame_defaults(&c->prev);

View File

@@ -21,6 +21,7 @@
*/
#include "avcodec.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
static av_cold int decode_init(AVCodecContext *avctx)
@@ -51,7 +52,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
pic->reference = 0;
if ((ret = avctx->get_buffer(avctx, pic)) < 0)
if ((ret = ff_get_buffer(avctx, pic)) < 0)
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;

View File

@@ -25,7 +25,14 @@
#define _WIN32_WINNT 0x0600
#define COBJMACROS
#include "config.h"
#include "dxva2.h"
#if HAVE_DXVA_H
#include <dxva.h>
#endif
#include "avcodec.h"
#include "mpegvideo.h"

View File

@@ -112,8 +112,8 @@ static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *
int yoffset = ((buf[i] >> 4)) - 7;
if (s->last_frame.data[0])
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
s->last_frame.data[0], s->last_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
s->last_frame.data[0], s->last_frame.linesize[0],
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
}
i++;
}

View File

@@ -29,6 +29,7 @@
*/
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "dsputil.h"
#include "aandcttab.h"
@@ -143,6 +144,11 @@ static inline int decode_block_intra(MadContext * t, DCTELEM * block)
break;
} else if (level != 0) {
i += run;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR,
"ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
j = scantable[i];
level = (level*quant_matrix[j]) >> 4;
level = (level-1)|1;
@@ -157,6 +163,11 @@ static inline int decode_block_intra(MadContext * t, DCTELEM * block)
run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
i += run;
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR,
"ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
j = scantable[i];
if (level < 0) {
level = -level;
@@ -168,10 +179,6 @@ static inline int decode_block_intra(MadContext * t, DCTELEM * block)
level = (level-1)|1;
}
}
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
block[j] = level;
}
@@ -246,32 +253,34 @@ static int decode_frame(AVCodecContext *avctx,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf_end = buf+buf_size;
MadContext *t = avctx->priv_data;
GetByteContext gb;
MpegEncContext *s = &t->s;
int chunk_type;
int inter;
if (buf_size < 17) {
av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
*data_size = 0;
return -1;
}
bytestream2_init(&gb, buf, buf_size);
chunk_type = AV_RL32(&buf[0]);
chunk_type = bytestream2_get_le32(&gb);
inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
buf += 8;
bytestream2_skip(&gb, 10);
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
AV_RL16(&buf[6]), 1000, 1<<30);
bytestream2_get_le16(&gb), 1000, 1<<30);
s->width = AV_RL16(&buf[8]);
s->height = AV_RL16(&buf[10]);
calc_intra_matrix(t, buf[13]);
buf += 16;
s->width = bytestream2_get_le16(&gb);
s->height = bytestream2_get_le16(&gb);
bytestream2_skip(&gb, 1);
calc_intra_matrix(t, bytestream2_get_byte(&gb));
bytestream2_skip(&gb, 2);
if (bytestream2_get_bytes_left(&gb) < 2) {
av_log(avctx, AV_LOG_ERROR, "Input data too small\n");
return AVERROR_INVALIDDATA;
}
if (avctx->width != s->width || avctx->height != s->height) {
if((s->width * s->height)/2048*7 > buf_end-buf)
if((s->width * s->height)/2048*7 > bytestream2_get_bytes_left(&gb))
return -1;
if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
return -1;
@@ -290,13 +299,14 @@ static int decode_frame(AVCodecContext *avctx,
}
}
av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size,
bytestream2_get_bytes_left(&gb) + FF_INPUT_BUFFER_PADDING_SIZE);
if (!t->bitstream_buf)
return AVERROR(ENOMEM);
bswap16_buf(t->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
memset((uint8_t*)t->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
bswap16_buf(t->bitstream_buf, (const uint16_t *)(buf + bytestream2_tell(&gb)),
bytestream2_get_bytes_left(&gb) / 2);
memset((uint8_t*)t->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&s->gb, t->bitstream_buf, 8*(bytestream2_get_bytes_left(&gb)));
for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
for (s->mb_x=0; s->mb_x < (avctx->width +15)/16; s->mb_x++)
if(decode_mb(t, inter) < 0)

View File

@@ -43,6 +43,7 @@ typedef struct TgqContext {
ScanTable scantable;
int qtable[64];
DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
GetByteContext gb;
} TgqContext;
static av_cold int tgq_decode_init(AVCodecContext *avctx){
@@ -141,39 +142,36 @@ static void tgq_idct_put_mb_dconly(TgqContext *s, int mb_x, int mb_y, const int8
}
}
static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){
static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x){
int mode;
int i;
int8_t dc[6];
mode = bytestream_get_byte(bs);
if (mode>buf_end-*bs) {
av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");
return;
}
mode = bytestream2_get_byte(&s->gb);
if (mode>12) {
GetBitContext gb;
init_get_bits(&gb, *bs, mode*8);
init_get_bits(&gb, s->gb.buffer, FFMIN(s->gb.buffer_end - s->gb.buffer, mode) * 8);
for(i=0; i<6; i++)
tgq_decode_block(s, s->block[i], &gb);
tgq_idct_put_mb(s, s->block, mb_x, mb_y);
bytestream2_skip(&s->gb, mode);
}else{
if (mode==3) {
memset(dc, (*bs)[0], 4);
dc[4] = (*bs)[1];
dc[5] = (*bs)[2];
memset(dc, bytestream2_get_byte(&s->gb), 4);
dc[4] = bytestream2_get_byte(&s->gb);
dc[5] = bytestream2_get_byte(&s->gb);
}else if (mode==6) {
memcpy(dc, *bs, 6);
bytestream2_get_buffer(&s->gb, dc, 6);
}else if (mode==12) {
for(i=0; i<6; i++)
dc[i] = (*bs)[i*2];
for (i = 0; i < 6; i++) {
dc[i] = bytestream2_get_byte(&s->gb);
bytestream2_skip(&s->gb, 1);
}
}else{
av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode);
}
tgq_idct_put_mb_dconly(s, mb_x, mb_y, dc);
}
*bs += mode;
}
static void tgq_calculate_qtable(TgqContext *s, int quant){
@@ -193,28 +191,30 @@ static int tgq_decode_frame(AVCodecContext *avctx,
AVPacket *avpkt){
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf_start = buf;
const uint8_t *buf_end = buf + buf_size;
TgqContext *s = avctx->priv_data;
int x,y;
int big_endian = AV_RL32(&buf[4]) > 0x000FFFFF;
buf += 8;
if(8>buf_end-buf) {
if (buf_size < 16) {
av_log(avctx, AV_LOG_WARNING, "truncated header\n");
return -1;
}
s->width = big_endian ? AV_RB16(&buf[0]) : AV_RL16(&buf[0]);
s->height = big_endian ? AV_RB16(&buf[2]) : AV_RL16(&buf[2]);
bytestream2_init(&s->gb, buf + 8, buf_size - 8);
if (big_endian) {
s->width = bytestream2_get_be16u(&s->gb);
s->height = bytestream2_get_be16u(&s->gb);
} else {
s->width = bytestream2_get_le16u(&s->gb);
s->height = bytestream2_get_le16u(&s->gb);
}
if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
avcodec_set_dimensions(s->avctx, s->width, s->height);
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
}
tgq_calculate_qtable(s, buf[4]);
buf += 8;
tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb));
bytestream2_skip(&s->gb, 3);
if (!s->frame.data[0]) {
s->frame.key_frame = 1;
@@ -226,14 +226,14 @@ static int tgq_decode_frame(AVCodecContext *avctx,
}
}
for (y=0; y<(avctx->height+15)/16; y++)
for (x=0; x<(avctx->width+15)/16; x++)
tgq_decode_mb(s, y, x, &buf, buf_end);
for (y = 0; y < FFALIGN(avctx->height, 16) >> 4; y++)
for (x = 0; x < FFALIGN(avctx->width, 16) >> 4; x++)
tgq_decode_mb(s, y, x);
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->frame;
return buf-buf_start;
return avpkt->size;
}
static av_cold int tgq_decode_end(AVCodecContext *avctx){

View File

@@ -62,7 +62,7 @@ static int tqi_decode_mb(MpegEncContext *s, DCTELEM (*block)[64])
int n;
s->dsp.clear_blocks(block[0]);
for (n=0; n<6; n++)
if(ff_mpeg1_decode_block_intra(s, block[n], n)<0)
if (ff_mpeg1_decode_block_intra(s, block[n], n) < 0)
return -1;
return 0;
@@ -137,7 +137,7 @@ static int tqi_decode_frame(AVCodecContext *avctx,
for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++)
for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++)
{
if(tqi_decode_mb(s, t->block) < 0)
if (tqi_decode_mb(s, t->block) < 0)
break;
tqi_idct_put(t, t->block);
}

View File

@@ -110,7 +110,7 @@ static int get_high_utility_cell(elbg_data *elbg)
while (elbg->utility_inc[i] < r)
i++;
assert(!elbg->cells[i]);
assert(elbg->cells[i]);
return i;
}

View File

@@ -440,9 +440,14 @@ static void guess_mv(MpegEncContext *s)
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
num_avail <= mb_width / 2) {
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
s->mb_x = 0;
s->mb_y = mb_y;
ff_init_block_index(s);
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
const int mb_xy = mb_x + mb_y * s->mb_stride;
ff_update_block_index(s);
if (IS_INTRA(s->current_picture.f.mb_type[mb_xy]))
continue;
if (!(s->error_status_table[mb_xy] & ER_MV_ERROR))
@@ -477,6 +482,9 @@ static void guess_mv(MpegEncContext *s)
changed = 0;
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
s->mb_x = 0;
s->mb_y = mb_y;
ff_init_block_index(s);
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
const int mb_xy = mb_x + mb_y * s->mb_stride;
int mv_predictor[8][2] = { { 0 } };
@@ -488,6 +496,8 @@ static void guess_mv(MpegEncContext *s)
const int mot_index = (mb_x + mb_y * mot_stride) * mot_step;
int prev_x, prev_y, prev_ref;
ff_update_block_index(s);
if ((mb_x ^ mb_y ^ pass) & 1)
continue;
@@ -911,6 +921,12 @@ void ff_er_frame_end(MpegEncContext *s)
return;
};
if (s->picture_structure == PICT_FRAME &&
s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) {
av_log(s->avctx, AV_LOG_ERROR, "Error concealment not possible, frame not fully initialized\n");
return;
}
if (s->current_picture.f.motion_val[0] == NULL) {
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
@@ -1098,11 +1114,16 @@ void ff_er_frame_end(MpegEncContext *s)
/* handle inter blocks with damaged AC */
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
s->mb_x = 0;
s->mb_y = mb_y;
ff_init_block_index(s);
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
const int mb_xy = mb_x + mb_y * s->mb_stride;
const int mb_type = s->current_picture.f.mb_type[mb_xy];
int dir = !s->last_picture.f.data[0];
ff_update_block_index(s);
error = s->error_status_table[mb_xy];
if (IS_INTRA(mb_type))
@@ -1140,11 +1161,16 @@ void ff_er_frame_end(MpegEncContext *s)
/* guess MVs */
if (s->pict_type == AV_PICTURE_TYPE_B) {
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
s->mb_x = 0;
s->mb_y = mb_y;
ff_init_block_index(s);
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
int xy = mb_x * 2 + mb_y * 2 * s->b8_stride;
const int mb_xy = mb_x + mb_y * s->mb_stride;
const int mb_type = s->current_picture.f.mb_type[mb_xy];
ff_update_block_index(s);
error = s->error_status_table[mb_xy];
if (IS_INTRA(mb_type))

View File

@@ -48,8 +48,8 @@ typedef struct Escape124Context {
CodeBook codebooks[3];
} Escape124Context;
static int can_safely_read(GetBitContext* gb, int bits) {
return get_bits_count(gb) + bits <= gb->size_in_bits;
static int can_safely_read(GetBitContext* gb, uint64_t bits) {
return get_bits_left(gb) >= bits;
}
/**
@@ -90,7 +90,7 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,
unsigned i, j;
CodeBook cb = { 0 };
if (!can_safely_read(gb, size * 34))
if (!can_safely_read(gb, size * 34L))
return cb;
if (size >= INT_MAX / sizeof(MacroBlock))

View File

@@ -110,11 +110,11 @@ av_cold void ff_ccitt_unpack_init(void)
ccitt_vlc[1].table = code_table2;
ccitt_vlc[1].table_allocated = 648;
for(i = 0; i < 2; i++){
init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS,
ccitt_codes_lens[i], 1, 1,
ccitt_codes_bits[i], 1, 1,
ccitt_syms, 2, 2,
INIT_VLC_USE_NEW_STATIC);
ff_init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS,
ccitt_codes_lens[i], 1, 1,
ccitt_codes_bits[i], 1, 1,
ccitt_syms, 2, 2,
INIT_VLC_USE_NEW_STATIC);
}
INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11,
ccitt_group3_2d_lens, 1, 1,
@@ -228,7 +228,7 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
mode = !mode;
}
//sync line pointers
while(run_off <= offs){
while(offs < width && run_off <= offs){
run_off += *ref++;
run_off += *ref++;
}
@@ -243,7 +243,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs)
PutBitContext pb;
int run, mode = ~0, pix_left = width, run_idx = 0;
init_put_bits(&pb, dst, size*8);
init_put_bits(&pb, dst, size);
while(pix_left > 0){
run = runs[run_idx++];
mode = ~mode;

View File

@@ -255,7 +255,7 @@ static void find_best_state(uint8_t best_state[256][256], const uint8_t one_stat
occ[j]=1.0;
for(k=0; k<256; k++){
double newocc[256]={0};
for(m=0; m<256; m++){
for(m=1; m<256; m++){
if(occ[m]){
len -=occ[m]*( p *l2tab[ m]
+ (1-p)*l2tab[256-m]);
@@ -451,7 +451,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w,
int run_mode=0;
if(s->ac){
if(c->bytestream_end - c->bytestream < w*20){
if(c->bytestream_end - c->bytestream < w*35){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
@@ -722,6 +722,10 @@ static av_cold int init_slice_contexts(FFV1Context *f){
int i;
f->slice_count= f->num_h_slices * f->num_v_slices;
if (f->slice_count <= 0) {
av_log(f->avctx, AV_LOG_ERROR, "Invalid number of slices\n");
return AVERROR(EINVAL);
}
for(i=0; i<f->slice_count; i++){
FFV1Context *fs= av_mallocz(sizeof(*fs));
@@ -993,7 +997,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
}
gob_count= strtol(p, &next, 0);
if(next==p || gob_count <0){
if(next==p || gob_count <=0){
av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n");
return -1;
}
@@ -1547,20 +1551,48 @@ static int read_header(FFV1Context *f){
memset(state, 128, sizeof(state));
if(f->version < 2){
f->version= get_symbol(c, state, 0);
f->ac= f->avctx->coder_type= get_symbol(c, state, 0);
if(f->ac>1){
for(i=1; i<256; i++){
f->state_transition[i]= get_symbol(c, state, 1) + c->one_state[i];
int chroma_h_shift, chroma_v_shift, colorspace, bits_per_raw_sample;
int transparency;
unsigned v = get_symbol(c, state, 0);
if (v > 1) {
av_log(f->avctx, AV_LOG_ERROR,
"invalid version %d in version 1 header\n", v);
return AVERROR_INVALIDDATA;
}
f->version = v;
f->ac = f->avctx->coder_type = get_symbol(c, state, 0);
if (f->ac > 1) {
for (i = 1; i < 256; i++)
f->state_transition[i] =
get_symbol(c, state, 1) + c->one_state[i];
}
colorspace = get_symbol(c, state, 0); //YUV cs type
bits_per_raw_sample = f->version > 0 ? get_symbol(c, state, 0) : f->avctx->bits_per_raw_sample;
get_rac(c, state); //no chroma = false
chroma_h_shift = get_symbol(c, state, 0);
chroma_v_shift = get_symbol(c, state, 0);
transparency = get_rac(c, state);
if (f->plane_count) {
if (colorspace != f->colorspace ||
bits_per_raw_sample != f->avctx->bits_per_raw_sample ||
chroma_h_shift != f->chroma_h_shift ||
chroma_v_shift != f->chroma_v_shift ||
transparency != f->transparency) {
av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n");
return AVERROR_INVALIDDATA;
}
}
f->colorspace= get_symbol(c, state, 0); //YUV cs type
if(f->version>0)
f->avctx->bits_per_raw_sample= get_symbol(c, state, 0);
get_rac(c, state); //no chroma = false
f->chroma_h_shift= get_symbol(c, state, 0);
f->chroma_v_shift= get_symbol(c, state, 0);
f->transparency= get_rac(c, state);
f->colorspace = colorspace;
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
f->chroma_h_shift = chroma_h_shift;
f->chroma_v_shift = chroma_v_shift;
f->transparency = transparency;
f->plane_count= 2 + f->transparency;
}

Some files were not shown because too many files have changed in this diff Show More