Compare commits

...

349 Commits

Author SHA1 Message Date
Andreas Cadhalpun
21d0ae829f nutdec: abort if EOF is reached in decode_info_header/read_sm_data
These loops can take a lot of time if count is very large.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-23 00:57:08 +02:00
Andreas Cadhalpun
af27254eb3 nutdec: stop skipping bytes at EOF
This can unnecessarily waste a lot of time.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-23 00:56:38 +02:00
Andreas Cadhalpun
ffb4362bf0 nutdec: fix infinite resync loops
nut->last_syncpoint_pos doesn't necessarily change between resync
attempts, so find_any_startcode can return the same startcode again.

Thus remember where the last resync happened and don't try to resync
before that.

This can't be done locally in nut_read_packet, because this wouldn't
prevent infinite resync loops, where after the resync a packet is
returned and while reading a following packet the resync happens again.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-23 00:55:57 +02:00
Michael Niedermayer
3ea101b234 avformat/nutdec: Check X in 2nd branch of index reading
Prevents read of uninitialized variable

Based on patch by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ebb0ca3d70465ab6d369a66b2ef43bb059705db8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-23 00:52:44 +02:00
Michael Niedermayer
3c7ea2c46e Update for 2.5.7
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 21:42:38 +02:00
Michael Niedermayer
682ccd4167 avformat/nutdec: Fix recovery when immedeately after seeking a failure happens
Found-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3496b4a33e806b7afdcbbf6f468b0332b676d7c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
e7e1832cfd avformat/nutdec: Return error on EOF from get_str()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6bbb2f8f4da67af374d62403742482cc5962aa21)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Andreas Cadhalpun
23e88c81d6 nutdec: fix memleaks on error in nut_read_header
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 361702660d2c37a63b7d6381d39e1e1de8405260)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Martin Storsjö
6b7c621839 rtsp: Make sure we don't write too many transport entries into a fixed-size array
(cherry picked from commit b90adb0aba073f9c1b4abca852119947393ced4c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Andrey Utkin
3d65a272da rtpenc_jpeg: handle case of picture dimensions not dividing by 8
This fixes the calculation of the number of needed blocks to make
sure that ALL pixels are represented by the result.

Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7f64a7503b19b39f1251e4380987034c569bebf5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
458ba000a5 avformat/mp3dec: Check for avcodec_alloc_context3() failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b851bc20c6931c084710e69f7eec30d8c1bdb68e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
64c82912a7 avformat/mp3dec: properly allocate dummy AVCodecContext
Fixes (harmless) use of uninitialized variable

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

Conflicts:

	libavformat/mp3dec.c
2015-05-21 20:43:39 +02:00
Nicolas George
1aaf9613a8 lavd/xcbgrab: fix comparison with screen size.
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7971fa9ce0ead8d2e8a79dbe422e91dcef8222ba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
8b95fc6d8d avcodec/golomb: get_ur_golomb_jpegls: Fix reading huge k values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c720b9ce9850710e74a103d9626869e397a89faa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
10b77a3471 avformat/mov: Fix parsing short loci
Fixes Ticket4557

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
7e3d413f12 avformat/mov: Print reason of loci parsing failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9e4f0cfc8ff4ab635ea12bdbd8d85d8bb1ba25f9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
1bf416dfc3 avcodec/hevc: Fix typo in num_entry_point_offsets check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3051e7fa712dfe2136f19b7157211453895f2a3c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
d3c9d87eea avcodec/libtheoraenc: Check for av_malloc failure
Fixes CID1257799

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
228f7c7eed avcodec/dcadec: Check active_bands
Fixes CID1297594 part2

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
ba82b23a1d avcodec/dcadec: Check scale table index
Fixes CID1297594 part 1

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

Conflicts:

	libavcodec/dcadec.c
2015-05-21 20:43:39 +02:00
Michael Niedermayer
665b343f92 avcodec/sonic: More completely check sample_rate_index and channels
Fixes CID1271783

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
43f9ec7113 avcodec/sonic: check memory allocations
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c131a9fead5bf63215b6e1172b3c5c183cf90b85)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
8d02ba5b7b avcodec/smvjpegdec: check avcodec_decode_video2() return code
Fixes CID1271810

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
cb0cc44f3a avcodec/shorten: More complete pred_order check
Fixes CID1239055

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
71689e7863 avcodec/shorten: Check skip_bytes()
Fixes CID1210526

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
d2fbf8b569 avcodec/shorten: Fix code depending on signed overflow behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2d15588124ab1d4c0612cab66f02a716f1509211)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
c14359f24d avcodec/proresdec2: Reset slice_count on deallocation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c4c6aea397f62421bf8ef0449b2b465a53e4ab4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
9fb1c02f30 ffmpeg_opt: Fix -timestamp parsing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 107e4da47644fe615ea821d6a19682d73789aca7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
4a49f1e764 avcodec/dcadec: Check subsubframes
Fixes: CID1239152

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
474bfd5438 avcodec/dcadec: Check nchans
Fixes CID1239110

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
wm4
02c1074f18 hevc: make avcodec_decode_video2() fail if get_format() fails
Personally, I need the decoder to back out if get_format() returns no
usable pixel format. This didn't work because the error code was not
propagated down the call chain. This in turn happened because the
variable declaration removed in this patch shadowed the variable, whose
value is returned at the end of the function. Consequently, failures of
decode_nal_unit() were ignored in this place.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
db00ecbc96 avcodec/cavsdec: Use ff_set_dimensions()
Fixes CID1239111 part2

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:39 +02:00
Michael Niedermayer
ebdbb13108 avcodec/cavsdec: Check esc_code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 139e1c8009df7729a53eaaae7036ca01071aced5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
cdc4727766 avcodec/on2avc: Check run more carefully
Fixes CID1239106

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
4858ee1d9c avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE
This avoids potential accesses over the end

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Rainer Hochecker
63d484c342 swr: fix alignment issue caused by 8ch sse functions
Fix crash when doing 8 ch conversion from apps compiled with MSVS
Thanks to Ronald for giving this hint:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-May/173049.html

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit adb7372f7495927a226edf9b8e1d0ac9453985ea)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
4c6224b1cd avcodec/mjpegdec: fix len computation in ff_mjpeg_decode_dqt()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 81cf9108563510dee24f73b2c5d94a7bd07ff747)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
bf2254bffd avcodec/jpeg2000dec: fix boolean operator
Fixes CID1271791 #7-6

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
2cab5f4ad0 avcodec/hevc_ps: Explicitly check num_tile_* for negative values
This fixes nothing but maybe helps coverity which does not see that this is failing later

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
1ed8a10487 avcodec/hevc_ps: Check vps_num_hrd_parameters
Fix CID1239052 part2

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
502684348b avcodec/hevc_ps: More completely check vps_num_layer_sets
Fixes CID1239052  part1

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
58f310f496 avcodec/hevc: Check num_entry_point_offsets
Fixes CID1239099 part 2

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
0230a8efc6 avcodec/hevc: Check offset_len
Fixes CID1239099 part 1

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Nick Lewycky
ef5fa5099b libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list on x86_64, because it isn't implicitly included when PIC is on.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 48e9f68384a2af257b9ca7633bf14f0c2748edc6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
885f501f7a avcodec/hevc_sei: Check num_sps_ids_minus1 value
Fixes CID1271794

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
00223d461b avcodec/vqavideo: Check chunk size
Fixes CID1239154

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Andreas Cadhalpun
7d45230d81 aacdec: don't return frames without data
Since commit 676a395a aac->frame->data is not necessarily allocated at
the end of aac_decode_frame_int if avctx->channels is 0.

In this case a bogus frame without any data, but non-zero nb_samples is
returned.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
254e3af60f avformat/hevc: Check num_negative_pics and num_positive_pics
Fixes CID1238994

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
05c2801413 avformat/hevc: Check cpb_cnt_minus1
Fixes CID1239014

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
b7a3a3a8d2 avformat/matroskadec: Cleanup error handling for bz2 & zlib
Fixes CID703652

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
2012a226d2 avformat/nutdec: Fix use of uinitialized value
Fixes CID1041175

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
b8e0b6c702 avformat/rtpenc_jpeg: Check remaining buffer size for SOS
Fixes CID1238818

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
1973b6ac5c avformat/rtpdec_xiph: Check upper bound on len in xiph_handle_packet()
Larger packets are not supported and would cause problems later

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
9c10c0fdcd tools/graph2dot: use larger data types than int for array/string sizes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit acf4925f444636a828534ab47d0f86c21a7a9b4e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Andreas Cadhalpun
596b9d6ed8 id3v2: catch avio_read errors in check_tag
Since len is an unsigned int, the comparison is currently treated as
unsigned and thus ignores all errors from avio_read.

Thus cast len to int, which is unproblematic, because at that point len
is between 0 and 4.

This fixes 'Conditional jump or move depends on uninitialised value'
valgrind warnings in is_tag.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
699357dd4e avformat/matroskaenc: Check ff_vorbiscomment_length in put_flac_codecpriv()
Its currently guaranteed to be smaller but its safer to check anyway

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
ff0f0b1e83 avformat/oggenc: Check ff_vorbiscomment_length in ogg_write_vorbiscomment()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0db5b2b9f8a96298eeba7988d43c4eb44220fab3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
cb1ecf08b2 avformat/flacenc: Check length in flac_write_block_comment()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 40a7700b82aec0036622f8673ce64e070a520891)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
e3d9bf1151 avformat/subtitles: Use size_t for len
string length could theoretically be larger than int

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a633928d47057426a9c328da594407d1c7da8a5c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
b2d31dcf04 avformat/url: Use size_t for len from strlen()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 95efc651294b3cf3e5ec4b3ed36e79d7261545ff)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
a9f003b8ac avutil/avstring: Use size_t in av_strlcatf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ae4eea8be45a0b212fd57ceaac1f11089ab81d98)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
4d3450d62f avformat/vorbiscomment: Check entry length in ff_vorbiscomment_write()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit eca38864a6ce5053e463b8d3fc22b22bc9a49578)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:38 +02:00
Michael Niedermayer
466575c0e0 avutil/dict: Use size_t for appending strings
the string length is not constrained to INT_MAX

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

Conflicts:

	libavutil/dict.c
2015-05-21 20:43:38 +02:00
Michael Niedermayer
dc8f42e037 libavutil/mem: use size_t for the length in av_strdup()
the string length is not constrained to INT_MAX

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
bb523c1b86 aacsbr: break infinite loop in sbr_hf_calc_npatches
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 584cc1ade10a3297ef9c107ef3a2081c04024156)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
b8568c546e diracdec: check that block length is valid
In init_planes p->xblen and p->yblen are set to:
            p->xblen = s->plane[0].xblen >> s->chroma_x_shift;
            p->yblen = s->plane[0].yblen >> s->chroma_y_shift;

These are later used as block_w and block_h arguments of
s->vdsp.emulated_edge_mc. If one of them is 0 it triggers an av_assert2
in emulated_edge_mc:
    av_assert2(start_x < end_x && block_w > 0);
    av_assert2(start_y < end_y && block_h > 0);

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
7d58774360 diracdec: check if reference could not be allocated
s->ref_pics[i] is later used as ref argument of interpolate_refplane,
where it is dereferenced.

If it is NULL, it causes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
448d6488b1 diracdec: avoid overflow of bytes*8 in decode_lowdelay
If bytes is large enough, bytes*8 can overflow and become negative.

In that case 'bufsize -= bytes*8' causes bufsize to increase instead of
decrease.

This leads to a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
e67181a351 diracdec: prevent overflow in data_unit_size check
buf_idx + data_unit_size can overflow, causing the '> buf_size' check to
wrongly fail.

This causes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
84db3e6648 avidec: avoid infinite loop due to negative ast->sample_size
If max in clean_index is set to a negative ast->sample_size, the
following loop never ends:
        while (max < 1024)
            max += max;

Thus set ast->sample_size to 0 if it would otherwise be negative.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
d8bfa4bb94 avformat/matroskadec: Use tracks[k]->stream instead of s->streams[k]
The later is not correct

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
39115c01f0 matroskadec: check s->streams[k] before using it
This fixes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
e337d5f1b1 avcodec/ffv1dec: Check chroma shift parameters
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d43cd6b08ed555c303478e3133717fbb2236be6e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
454f63181a matroskadec: use uint64_t instead of int for index_scale
index_scale is set to matroska->time_scale of type uint64_t.

When index_scale is int, the assignment can overflow and e.g. result
in index_scale = 0. This causes a floating point exception due to the
division by index_scale.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
9b12e4c1e3 pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
AV_PIX_FMT_MONOBLACK has the AV_PIX_FMT_FLAG_BITSTREAM flag, i.e.
linesize can be smaller than width.

Since x_offset is only check against the width, this can lead to
x_offset * bpp >= image_linesize.

In this case ptr could be set to a position outside the image_buf in
png_handle_row, leading to memory corruption and thus crashes.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
b04f6dfd3c pngdec: return correct error code from decode_frame_common
During the loop ret can get changed. Since it is not set on all failure
paths, decode_frame_common can return 0 even though an error occurred.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
c3653e2265 pngdec: check s->last_picture.f->data[0] before using it
This check was removed in commit 08aec6f6, but
s->last_picture.f->data[0] is still used in handle_p_frame_apng
unconditionally.

This fixes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
4d6d159069 avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow and undefined behavior in fate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 042260cde4ecf716438c5fc92d15ad5f037ee2e1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Luca Barbato
77059eedb5 xcbgrab: Validate the capture area
And notify why the capture is impossible.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Luca Barbato
31601db12a xcbgrab: Do not assume the non shm image data is always available
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 82a10225f817b2612fdd2b23af9d4f0a3408df3b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
69f122abd9 avfilter/lavfutils: disable frame threads when decoding a single image
The image decoding code does expect the image to be decoded immedeatly

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

Conflicts:

	libavfilter/lavfutils.c
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
8016800a64 nutdec: fix illegal count check in decode_main_header
The existing check has two problems:
 1) i + count can overflow, so that the check '< 256' returns true.
 2) In the (i == 'N') case occurs a j-- so that the loop runs once more.

This can trigger the assertion 'nut->header_len[0] == 0' or cause
segmentation faults or infinite hangs.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
4158d55b9a nutdec: check chapter creation in decode_info_header
This fixes a segmentation fault when accessing the metadata.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
b8627a63d8 nutdec: check for negative frame rate in decode_info_header
A negative frame rate triggers an av_assert2 in av_rescale_rnd.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
260f6b4418 ffmpeg: remove incorrect network deinit
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e2877bdf3862325c2982c3237d9bf28f1bbf793f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
c946f2cc83 apedec: prevent out of array writes in decode_array_0000
s->decoded_buffer is allocated with a min_size of:
    2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)

Then it is assigned to s->decoded[0] (and s->decoded_buffer + FFALIGN(blockstodecode, 8)
to s->decoded[1]) and passed as out buffer to decode_array_0000.

In this function 64 elements of the out buffer are written
unconditionally and outside the array if blockstodecode is too small.

This causes memory corruption, leading to segmentation faults or other
crashes.

Thus change decode_array_0000 to write at most blockstodecode elements
of the out buffer.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Maneesh Gupta
1e6352578a OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
The opt_opencl_bench function copied the device name using strcpy without checking if the source string was larger.
This patch fixes this by replacing the strcpy with av_strlcpy, with the string copy size capped to the destination buffer size.

Signed-off-by: Maneesh Gupta <maneesh.gupta@amd.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cf234552b83a9503ff96572de2658b921b8842eb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
d269eb2c11 apedec: set s->samples only when init_frame_decoder succeeded
Otherwise range_start_decoding is not necessarily run and thus
ctx->rc.range still 0 in range_dec_normalize leading to an infinite
loop.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Rong Yan
cb63a8c646 swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF() it was wrong
GCC tool had a bug of PPC intrinsic interpret, which has been fixed in GCC 4.9.1. This bug lead to
errors in two of our previous patches. We found this when we update our GCC tools to 4.9.1 and by
reading the related info on GCC website. We fix our previous error in two separate commits

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
James Zern
2f85f511ff libvpxenc: only set noise reduction w/vp8
this quiets a warning:
Failed to set VP8E_SET_NOISE_SENSITIVITY codec control: Unspecified
internal error

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Zern <jzern@google.com>
(cherry picked from commit 238ec505e263e7d0363798a05c1c28f494a6300a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Michael Niedermayer
3afb2653bd tests/fate-run: do not attempt to parse tiny_psnrs output if it failed
This avoids confusing syntax errors with awk later

Likely fixes awk errors at:
http://buildd.debian-ports.org/status/fetch.php?pkg=ffmpeg&arch=sparc64&ver=7%3A2.6.2-1&stamp=1428928967

Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Thanks-to: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> for the link
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c0d847e457c1ef72843a63853f1135d52b74131e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
4c01572a94 alac: reject rice_limit 0 if compression is used
If rice_limit is 0, k can be 0 in decode_scalar, which calls show_bits(gb, k).

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
216ef1200a alsdec: only adapt order for positive max_order
For max_order = 0 the clipping range is invalid. (amin = 2, amax = 1)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Vittorio Giovara
b8f5996071 lavf: Reset global flag on deinit
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 32da94fa7f73ac749e0a1e2f20499fad2f6f57fe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:37 +02:00
Andreas Cadhalpun
004064912f bink: check vst->index_entries before using it
This fixes a NULL pointer dereference if vst->duration is 0.

The problem was introduced in commit 0588acaf.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:36 +02:00
Andreas Cadhalpun
5ae8df8d37 mpeg4videodec: only allow a positive length
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3408ae4c64cb674b1d5f0f30171759113ce722a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:36 +02:00
Andreas Cadhalpun
af70697836 alsdec: check sample pointer range in revert_channel_correlation
Also change the type of begin, end and smp to ptrdiff_t to make the
comparison well-defined.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit afc7748d1f6abc4b3b1cc957b0fa6941837db3d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-21 20:43:36 +02:00
Carl Eugen Hoyos
836a66eeb0 lavfi/fade: Do not overread input buffer.
(cherry picked from commit ab3ff19f08b7a83e320c39ab066f289c242b8030)
2015-05-17 12:46:35 +02:00
Clément Bœsch
346c4f0ad0 tests: drop bc dependency
We already have a dependency on awk and bc is sometimes not found in the
base system.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a982c5d74fbc7ff5bd2f2f73af61ae48e9b1bcc6)
Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/platform.texi
2015-05-13 17:11:04 -07:00
Timothy Gu
a2ad7fdb3a fate: Include branch information in the payload header
The server is properly equiped not to choke on that now.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 22:36:39 +02:00
Michael Niedermayer
5fd5b8ef79 avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba631b791435c395361e2026fc7419b341e57813)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 01:08:16 +02:00
Michael Niedermayer
3f629c83b4 avformat/img2dec: do not rewind custom io buffers
Fixes double free with some applications

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 00:12:17 +02:00
Andreas Cadhalpun
faac8e4331 alsdec: validate time diff index
If begin is smaller than t, the subtraction 'begin -= t' wraps around,
because begin is unsigned. The same applies for end < t.

This causes segmentation faults.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-19 01:27:04 +02:00
Michael Niedermayer
5be683d687 avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays never contain random data
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7e104647a3556fc61a139483cee1cb7dfa2dc5bd)

Conflicts:

	libavcodec/alsdec.c
2015-04-18 20:58:17 +02:00
Andreas Cadhalpun
96c1421627 alsdec: ensure channel reordering is reversible
If the same idx is used for more than one i, at least one entry in
sconf->chan_pos remains uninitialized.

This can cause segmentation faults.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-18 19:39:48 +02:00
Michael Niedermayer
8a59dbbc68 Update or 2.5.6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:57:45 +02:00
Michael Niedermayer
0683ef4b50 avcodec/atrac3plusdsp: fix on stack alignment
Fixes fate failure on ARM
(cherry picked from commit 38f67260684aec8a02d87ab4056b1a1fbf964c03)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Andreas Cadhalpun
b420354a8b ac3: validate end in ff_ac3_bit_alloc_calc_mask
This fixes an invalid read if end is 0:
     band_end   = ff_ac3_bin_to_band_tab[end-1] + 1;

Depending on what is before the array, this can cause stack smashing,
when band_end becomes too large.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Andreas Cadhalpun
1d0f9c92c5 aacpsy: avoid psy_band->threshold becoming NaN
If band->thr is 0.0f, the division is undefined, making norm_fac not a
number or infinity, which causes psy_band->threshold to become NaN.

This is passed on to other variables until it finally reaches
sce->sf_idx and is converted to an integer (-2147483648).

This causes a segmentation fault when it is used as array index.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Claudio Freire <klaussfreire@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e224aa41917454e7b5c23d9f2541425743ce595a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Andreas Cadhalpun
d846d3e88e aasc: return correct buffer size from aasc_decode_frame
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0be54ad280cf114c02306b7063147e8379f8ed1e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Andreas Cadhalpun
621f1a2e63 aacdec: consistently use avctx for logging in decode_eld_specific_config
ac may be NULL and then accessing ac->avctx results in a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Andreas Cadhalpun
9a241d95ef msrledec: use signed pixel_ptr in msrle_decode_pal4
This fixes segmentation faults, when pic->linesize[0] is negative.
In that case 'line * pic->linesize[0] + pixel_ptr' is treated as
unsigned and wraps around.

This reverts commit 7d78a964.
The problem was introduced in commit f7e1367f, which should obsolete
that commit.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:30 +02:00
Michael Niedermayer
41b15817ce swresample/swresample-test: Randomly wipe out channel counts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff50b1b13be965c93a9a7169edb62631a928e308)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
07ea57c5bb swresample: Check channel layouts and channels against each other and print human readable error messages
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c77bb5f23b2e149495c814759beab7eedeede6c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
84fedd3be7 swresample: Allow reinitialization without ever setting channel layouts
(cherry picked from commit 80a28c7509a11114e1aea5b208d56c6646d69c07)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
74fb9df48b swresample: Allow reinitialization without ever setting channel counts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d7b9cb2f7a51351586791e65fa22e6536ee58c9f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
8c0fd44317 avcodec/h264: Do not fail with randomly truncated VUIs
Fixes Ticket4445

Tested-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bc48c88918f767e0dffcd138ae8e5c3052e8a92f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
6f02d93c0f avcodec/h264_ps: Move truncation check from VUI to SPS
This more completely checks for truncation

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
9333ee7c0d avcodec/h264: Be more tolerant to changing pps id between slices
Fixes Ticket4446

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

Conflicts:

	libavcodec/h264.c
(cherry picked from commit 0cd0fa9d0baabd2dc0442ed8b53ba65282733b61)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
3e30424961 avcodec/aacdec: Fix storing state before PCE decode
Fixes Ticket4460

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
fe2df122b4 avcodec/h264: reset the counts in the correct context
Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8f8d632220100bfde26587b27da73901b05cb774)
2015-04-17 15:20:29 +02:00
Michael Niedermayer
f96fdb46b7 avcodec/h264_slice: Dont reset mb_aff_frame per slice
Fixes null pointer dereference
Fixes Ticket4440

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

Conflicts:

	libavcodec/h264_slice.c
(cherry picked from commit ce6d38e9ed0842870f3cd5414937bb6d1f2417d9)
2015-04-17 15:20:29 +02:00
Michael Niedermayer
7fa861dfe0 avcodec/h264: finish previous slices before switching to single thread mode
Fixes null pointer dereference
Fixes Ticket4438

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

Conflicts:

	libavcodec/h264.c
(cherry picked from commit 09cc7aee3f4d1bd1d7107d38520f782c62c14036)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
48f616ceee avcodec/h264: Fix race between slices where one overwrites data from the next
Fixes non deterministic crash in ticket4408/fuzz2.264
Likely fixes other samples as well

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

Conflicts:

	libavcodec/h264.h
	libavcodec/h264_slice.c
(cherry picked from commit dbbc42858e87cdd04e6c3b7694f8b394d4bfcdc6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
8968de6c61 avformat/utils: avoid discarded streams in av_find_default_stream_index()
Fixes Ticket2010

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
043cb40bec ffmpeg: Fix extradata allocation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4d02dfbde475d249916eb19c360e890059aa6aa5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
76b289bcf2 avcodec/h264_refs: Do not set reference to things which dont exist
Fixes deadlock
Fixes Ticket4428
Fixes Ticket4429

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
52ba406b94 avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode
Fixes Ticket4408

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Rainer Hochecker
071eb56a6a h264: avoid unnecessary calls to get_format
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2197b4018920e5cd7ac465de007b675565687b23)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
2f67222780 avutil/pca: Check for av_malloc* failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dadc43eee4d9036aa532665a04720238cc15e922)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
Michael Niedermayer
a376ef4a17 avcodec/msrledec: restructure msrle_decode_pal4() based on the line number instead of the pixel pointer
Fixes out of array access
Fixes: da14e86d8462be6493eab16bc2d40f88/asan_heap-oob_204cfd2_528_cov_340150052_COMPRESS.BMP

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 15:20:29 +02:00
James Almer
43fdd89a3f doc: add aarch64 cpuflags to fftools documentation
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 9fc45681e0c4736e4475966a70402d22c76a2965)
2015-04-11 16:23:52 -03:00
James Almer
60f2f332a3 doc: add missing arm cpuflags to fftools documentation
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 666ec9bd097201eaacb9c04da526cb2710cb9cab)
2015-04-11 16:23:50 -03:00
James Almer
7e05c70bb0 doc: add missing x86 cpuflags to fftools documentation
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 410c93cfd5ab509d8c9f907f88ae09a87fb743e6)
2015-04-11 16:23:47 -03:00
James Almer
b46840475e avutil/cpu: add missing check for mmxext to av_force_cpu_flags
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1f5d1eed78fad63f1c80a3766d3dc2421b99104d)
2015-03-28 22:10:50 -03:00
Michael Niedermayer
d0599a3516 avcodec/hevc_ps: Check cropping parameters more correctly
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 06c70d45373dedc600f28e345685b130b60203c1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 23:59:50 +01:00
Anton Khirnov
742d7e9a6e hevc: make the crop sizes unsigned
(cherry picked from commit c929659bdd7d2d5848ea52e685a3164c7b901bb0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 23:59:50 +01:00
James Almer
eb6f2a183a Update Changelog 2015-03-21 15:07:35 -03:00
Ronald S. Bultje
1e86b7108e vp9: make above buffer pointer 32-byte aligned.
Fixes ticket #4383

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1fd1f58bd6a58f2067a8d6b4919e1a0f34eb1f22)
2015-03-21 14:27:52 -03:00
Michael Niedermayer
4be1cc7b1d Update for 2.5.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 02:35:00 +01:00
Michael Niedermayer
61dbd3f3d0 avcodec/dnxhddec: Check that the frame is interlaced before using cur_field
Fixes Ticket4227

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Michael Niedermayer
38d6ff31b7 avformat/mov: Disallow ".." in dref unless use_absolute_path is set
as this kind of allows to circumvent it to some extend.
We also could add a separate parameter or value to choose this

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Michael Niedermayer
b0cd6fb590 avformat/mov: Check for string truncation in mov_open_dref()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8003816e1619e77d8de051883264aa090e0d78cc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Michael Niedermayer
50fd06ea32 avformat/mov: Use sizeof(filename) instead of a literal number
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 21a53dd08dce7cc5b3fdf9c4826b4b74d8300ea0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Christophe Gisquet
808d5444c4 eac3dec: fix scaling
This is the remaining error, the output on the SPX samples,
respectively csi_miami_stereo_128_spx.eac3 and
csi_miami_5.1_256_spx.eac3, goes from:
stddev:    8.71 PSNR: 77.52 MAXDIFF:  235
stddev:24270.51 PSNR: 22.17 MAXDIFF:47166
to:
stddev:    0.12 PSNR:114.12 MAXDIFF:    1
stddev:    0.12 PSNR:114.73 MAXDIFF:    1

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Christophe Gisquet
6915dd49c7 ac3_fixed: fix computation of spx_noise_blend
It was set to 1 instead of sqrt(3)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:53 +01:00
Christophe Gisquet
c657b08fd7 ac3_fixed: fix out-of-bound read
Should also improve decoding, but actually doesn't...

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
6d14bea8b5 ac3dec_fixed: always use the USE_FIXED=1 variant of the AC3DecodeContext
The AC3DecodeContext has a float (USE_FIXED=0) and an integer
(USE_FIXED=1) variant, both of which can be present in the same binary.
This is not only very confusing, but it also breaks horribly, when one
variant is used by code expecting the other.

This currently happens, because eac3dec.c is only compiled for the float
variant, but also used from ac3dec_fixed.c, which uses the integer
variant.

The result is memory corruption, leading to crashes.

So compile eac3dec.c once for each variant and adapt it, so that it
works with the integer variant.

A loss of precission and scaling bug has been fixed by the committer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7b05b5093ea67a3397b0c37cf398bab471e1ce2b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
749cd89ca9 avcodec/012v: redesign main loop
Fixes out of array accesses
Fixes: ffmpeg_012v_crash.ts

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
2b408d257f avcodec/012v: Check dimensions more completely
Fixes division by 0

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
8d853dc341 asfenc: fix leaking asf->index_ptr on error
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2c8cff2be4a044c66e4904efa156dafd0d332d25)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
86960b1101 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 cf82c426fadf90105e1fb9d5ecd267cc3aa2b288)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
94354e368d avcodec/options_table: remove extradata_size from the AVOptions table
allowing access to the size but not the extradata itself is not useful
and could lead to potential problems if writing happens through this field

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Reviewed-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1f4088b28540080ce1d42345c5614be3e1a6a197)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
93a0682b1d ffmdec: limit the backward seek to the last resync position
If resyncing leads to the same position as previously, it will again
lead to a resync attempt, resulting in an infinite loop.

Thus don't seek back beyond the last syncpoint.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
0e16c3843a ffmdec: make sure the time base is valid
A negative time base can trigger assertions.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
819955f0c6 ffmdec: fix infinite loop at EOF
If EOF is reached, while skipping bytes, avio_tell(pb) won't change
anymore, resulting in an infinite loop.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
b36bda3c82 ffmdec: initialize f_cprv, f_stvi and f_stau
They are used in a switch statement, but it is not guaranteed that the
COMM case (where they are set to 0) is reached before the other cases.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
25b8d52fdd avformat/rm: limit packet size
The chunk size is limited to 0xFFFF (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>

See Ticket244

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
1a2aaa7497 avcodec/webp: validate the distance prefix code
According to the WebP Lossless Bitstream Specification the highest
allowed value for a prefix code is 39.

If prefix_code is too large, the calculated extra_bits has an invalid
value and triggers an assertion in get_bits.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
f18fc45d18 avcodec/rv10: check size of s->mb_width * s->mb_height
If it doesn't fit into 12 bits it triggers an assertion.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Federico Tomassetti
2684ff3573 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>
(cherry picked from commit 061c489895d29049a88dc6118e4b639a273b31d6)

Conflicts:

	libavcodec/eamad.c
2015-03-21 01:52:52 +01:00
Federico Tomassetti
ea0f616a57 mdec: check for out of bounds read
Bug-Id: CID 1257501
CC: libav-stable@libav.org

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Martin Storsjö
51b911e948 configure: Move the .object_arch check to the right place
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b77e335e441040a40fc6156b8e4a134745d10233)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Martin Storsjö
bb508ddb8b arm: Suppress tags about used cpu arch and extensions
When all the codepaths using manually set .arch/.fpu code is
behind runtime detection, the elf attributes should be suppressed.

This allows tools to know that the final built binary doesn't
strictly require these extensions.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Vittorio Giovara
9246eb1ec5 aic: Fix decoding files with odd dimensions
Normally the aic decoder finds the proper slice combination (multiple of
some number less than 32) but in case of odd width, it resorts to the
default values, which were actually swapped.
The number of slices is modified to account for such odd width cases.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
c5b2ef3bdf 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 d5e9fc782150d4596c72440a0aa02b7f4f1254b1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
07df052d8d doc: avoid the incorrect phrase 'allow to'
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 10fd7ff814f2a35b5b49a9c3b0d426ead6c7e83f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Martin Storsjö
9bb7e2bd90 mxfdec: Fix the error handling for when strftime fails
The str variable is a char ** here.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
90fa2460c0 avcodec/opusdec: Fix delayed sample value
Fixes out of array access
Fixes: ffmpeg_opus_crash1.ogg

This solution is likely not optimal in terms of error concealment but
its simple and fixes the out of array access.

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 6c583e9048fe9db2ed4d7bbc75f4f1d76e82761a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
50f5037947 avcodec/opusdec: Clear out pointers per packet
This is safer than to assume that all error pathes cleared them and
nothing will use uncleared pointers.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Michael Niedermayer
21533730fc 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 e3201c38d53d2b8b24d0bc95d726b2cb1752dc12)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Ronald S. Bultje
032476f830 vp9: fix segmentation map retention with threading enabled.
Fixes ticket 4359.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Andreas Cadhalpun
57c7922331 webp: ensure that each transform is only used once
According to the WebP Lossless Bitstream Specification
"each transform is allowed to be used only once".

If a transform is more than once this can lead to memory
corruption.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:52 +01:00
Stefano Sabatini
73dd8f0a24 doc/protocols/tcp: fix units of listen_timeout option value, from microseconds to milliseconds
s->listen_timeout is passed to ff_listen_bind(), which accepts a timeout
value expressed in milliseconds.

The unit was incorrectly set in 1b4da43ce02452843a1e9bb976da1a39e18a945c.
(cherry picked from commit 6db20926c32ea297418f1f819585007c6b7b6160)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Steve Lhomme
55637b2e5e fix VP9 packet decoder returning 0 instead of the used data size
See https://trac.videolan.org/vlc/ticket/14022#comment:6

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
e6bc1fe10c avformat/flvenc: check that the codec_tag fits in the available bits
flags is later written with avio_w8 and if it doesn't fit in one byte it
triggers an av_assert2.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
e6b18f5700 avcodec/utils: use correct printf specifier in ff_set_sar
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 732c3ebffaff5005367d7f947fa903f3b6e92f68)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
3791436eb5 avutil/imgutils: correctly check for negative SAR components
These could trigger assert failures previously

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
61147f58ab swscale/utils: clear formatConvBuffer on allocation
Fixes use of uninitialized memory
Fixes: asan_heap-oob_35ca682_1474_cov_3230122439_aletrek_tga_16bit.mov

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
29e435ca33 avformat/bit: only accept the g729 codec and 1 channel
Other codecs/channel numbers are not supported by this muxer.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
0540d5c5fc 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 eeda2c3de8a8484d9e7d1e47ac836bec850b31fc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
7f97231d97 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 7faa40af982960608b117e20fec999b48011e5e0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
4005a71def avformat/adxdec: set avctx->channels in adx_read_header
It is used in adx_read_packet, which currently depends on the decoder/parser setting this value between reading the file header and demuxing the first packet.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Dyami Caliri
429347afa7 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 50833c9f7b4e1922197a8955669f8ab3589c8cef)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
James Cowgill
a81b6a662a mips/acelp_filters: fix incorrect register constraint
Change register constraint on the v variable from = to +. This was causing GCC
to think that the v variable was never read and therefore not initialize it.

This fixes about 20 fate failures on mips64el.

Signed-off-by: James Cowgill <james410@cowgill.org.uk>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b9de1303a6414174ab2f3bccefa801bfabcf0f88)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
6168fe32f1 avcodec/hevc_ps: Sanity checks for some log2_* values
log2 values which imply numeric overflow are not supported

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
711374b626 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 1f5c7781e63d6519192ada59c1e36bcecc92791d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
9a63a36dc6 avcodec/h264: Only reinit quant tables if a new PPS is allowed
Fixes null pointer dereference
Fixes: signal_sigsegv_3042097_3007_cov_1741463594_non_monotone_timestamps1.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
db1a99a209 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 8f4cbf940212079a34753c7f4d6c6b5a43586d30)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
fe8c81a0f3 swscale/utils: More carefully merge and clear coefficients outside the input
Fixes out of array read
Fixes: asan_heap-oob_35ca682_1474_cov_3230122439_aletrek_tga_16bit.mov

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
728051d9b1 avcodec/a64multienc: Assert that the Packet size does not grow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 29bbc1be488ea4fc591d3e0ef12f0fc7c8812afb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
99d58a0da4 avcodec/a64multienc: simplify frame handling code
This also fixes a memleak

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
9783f9fb98 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 87513d654546a99f8ddb045ca4fa5d33778a617e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
2ed0a77b7b avcodec/a64multienc: initialize mc_meta_charset to zero
This fixes the use of uninitialized values in avpriv_do_elbg.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
804e1e1610 avcodec/a64multienc: don't set incorrect packet size
This fixes invalid reads of the packet buffer in av_dup_packet

Based on patch by Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Andreas Cadhalpun
99d2d1404c avcodec/a64multienc: use av_frame_ref instead of copying the frame
This fixes freeing the frame buffer twice on cleanup leading to a crash.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
cb1c9294f3 avcodec/x86/mlpdsp_init: Simplify mlp_filter_channel_x86()
Based on patch by Francisco Blas Izquierdo Riera
Commit message partly taken from carl

fixes a compilation
error in mlpdsp_init.c with -fstack-check and some gcc compilers (I
reproduced the issue with gcc 4.7.3) by simplifying the code.

See also https://bugs.gentoo.org/show_bug.cgi?id=471756

$ make libavcodec/x86/mlpdsp_init.o
libavcodec/x86/mlpdsp_init.c: In function ‘mlp_filter_channel_x86’:
libavcodec/x86/mlpdsp_init.c:142:5: error: can’t find a register in
class ‘GENERAL_REGS’ while reloading ‘asm’
libavcodec/x86/mlpdsp_init.c:142:5: error: ‘asm’ operand has impossible
constraints

4551 -> 4509 dezicycles

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03f39fbb2a558153a3c464edec1378d637a755fe)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Anton Khirnov
84341627d7 h264: initialize H264Context.avctx in init_thread_copy
This prevents using a wrong (first thread's) AVCodecContext if decoding
a frame in the first pass over all threads fails.
(cherry picked from commit a06b0b1295c51d100101e0ca0434e199ad6de6b5)

Conflicts:

	libavcodec/h264.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
4f694182e0 avformat/omadec: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0f55bc29d41585d110b126cb4ed4b395fd46d7ac)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
a2cfb784fb avformat/vqf: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cb08687180683a755d0fe9d425280d0e4d1e6db2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
6faf18acbd avformat/wtvdec: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d44e0d8b930732a4a247b4884d75cf62b4ad3664)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
96807933d8 avformat/mvdec: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 26c0cc154e06cb0064b3a3da49447ac44d82444f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:51 +01:00
Michael Niedermayer
4ef32aa2a6 avformat/apngdec: Use 64bit for ret to avoid overflow
Missed this hunk in first commit

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Michael Niedermayer
727730e279 avformat/gxf: Use 64bit for res to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 12987f89007ee82b9d3a6090085dfaef8461ab8b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Michael Niedermayer
5a829ee69e avformat/idcin: Use 64bit for ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d1923d15a3544cbb94563a59e7169291db76b312)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Michael Niedermayer
7fe22c3fe6 avformat/apngdec: Use 64bit ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0e3d6e17dea758fdb7d0adfc57f7655551ab32b3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Michael Niedermayer
c7565b143c avformat/asfdec: Use 64bit ret to avoid overflow
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d4936d28a11fac6c9c4b4df9625185f93b086986)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Rodger Combs
303ecfc373 wtvdec: fix integer overflow resulting in errors with large files
This fixes a regression in 9fbc613f0df1628e7e78bca791fa8833846f8210

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 01:52:50 +01:00
Carl Eugen Hoyos
1456ed2dd5 lavf: Do not list mov-only codecs in riff.c.
Instead check for all mov code-points when demuxing avi
and print a warning if a video codec is found like this.
Fixes ticket #4307.
(cherry picked from commit 2e0b5f5c90a4bc1440703ba5e8bf7139ff42f367)

Conflicts:
	libavformat/riff.c
2015-03-13 09:15:18 +01:00
Michael Niedermayer
79c9d9b134 Revert "avutil/opencl: is_compiled flag not being cleared in av_opencl_uninit"
Fixed build with opencl enabled
Found-by:  WJ Liu

This reverts commit 0f2359b86926ed33da4bd64ca76d84d03d5ad380.

(cherry picked from commit ebd59d271c24601e08c3569681b129cd27bf4070)
2015-03-09 14:32:13 -03:00
Srikanth G
d0aa3d13fa avutil/opencl: is_compiled flag not being cleared in av_opencl_uninit
When OpenCL kernels are compiled, is_compiled flag is being set for each
kernel. But, in opencl uninit, this flag is not being cleared.
This causes an error when an OpenCL kernel is tried on different OpenCL
devices on same platform.

Here is the patch with a fix

Reviewed-by; Wei Gao <highgod0401@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

(cherry picked from commit 0f2359b86926ed33da4bd64ca76d84d03d5ad380)
2015-03-06 15:51:20 -03:00
Clément Bœsch
e5cc73e0a5 avcodec/gif: fix off by one in column offsetting finding
(cherry picked from commit f9240ec01abb097263fe578d2b6fb076bb7b9263)
2015-02-16 17:59:48 +01:00
Clément Bœsch
3429714f3d avfilter/dctdnoiz: fix slice_h computation
ceilf() can only work if the reminder of the division is not 0.

This fixes memory errors with for instance:
  ffmpeg -f lavfi -i testsrc=s=800x500 -threads 3 -vf dctdnoiz -frames:v 1 -f null -

(cherry picked from commit eb7efaa9244720c5f2051d76d76faeec864eca7a)
2015-02-12 20:21:56 +01:00
James Almer
ee902d3d2d x86/lossless_audiodsp: fix compilation with --disable-yasm
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 383fddeec65f4cebcb197eae702dfefdc6192eb0)

Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 20:04:09 +01:00
James Almer
9bc62da980 avutil/opencl: don't include config.h
It's not an installed header.

Tested-by: Thilo Borgmann <thilo.borgmann@mail.de>
Tested-by: Wei Gao <highgod0401@gmail.com>
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 3aaff803489af21011b8cf03847e17b29643c922)
2015-02-12 15:43:47 -03:00
James Almer
2a6d16ba5f x86/swr: add missing alignment check to pack_6ch functions
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 5f14f9e9849579b3418aebfde8a162d9c172d0ea)
2015-02-12 15:43:43 -03:00
Michael Niedermayer
c7e967a7cb Update for 2.5.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:44:24 +01:00
Michael Niedermayer
5262c88bb0 avformat/rtmpproto: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:55 +01:00
Michael Niedermayer
bd78b9416d avformat/riffdec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:54 +01:00
Michael Niedermayer
48ae72e501 avformat/os_support: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:11:54 +01:00
Michael Niedermayer
0f671dfeac avcodec/arm/videodsp_armv5te: Fix linking failure with "g++ -shared -D__STDC_CONSTANT_MACROS -o test.so ... libavcodec.a"
Tested-by: Andreas Haupt
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cab6302534962331753fb69c674df86a458b098d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
345962121d 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 08509c8f86626815a3e9e68d600d1aacbb8df4bf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0cbf53bdf5 avcodec/h264_slice: assert that reinit does not occur after the first slice
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2fd9ce92af43e6dcbc8ed7c26c00b052de48ccad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
b20409c690 avcodec/h264_slice: ignore SAR changes in slices after the first
Fixes race condition and null pointer dereference
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
7997ec54c9 avcodec/h264_slice: Check picture structure before setting the related fields
This might fix a hypothetical race condition

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
e805826903 avcodec/h264_slice: Do not change frame_num after the first slice
Fixes potential race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
137a000377 avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1750b45cdf7498d0a05bea29cafcb26aa576d595)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
78c314e39e avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0640e63463e6428b80422c89e1bfc96147ecfc6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
756d85dc14 avcodec/h264: Be more strict on rejecting pps/sps changes
Fixes race condition
Fixes: signal_sigsegv_1472ac3_468_cov_2915641226_CABACI3_Sony_B.jsv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
eeab3e1b20 avcodec/h264: Be more strict on rejecting pps_id changes
Fixes race condition
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 31cc9c04ca386dce289864021982da62190982ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
a75787a71a 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 69aa79365c1e8e1cb597d33e77bf1062c2ef47d4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
09425294c9 Revert "avcodec/x86/lossless_audiodsp: Make scalarproduct_and_madd_int16 prototypes more similar"
This reverts commit 3b4ffba3af968ae702e3a44f6b5f53445efc7363.

Unbreaks the SSSE3 code on mingw32

Conflicts:

	libavcodec/x86/lossless_audiodsp.asm

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
3572eaaf02 avcodec/x86/lossless_audiodsp: Move order&8 fallback into C code
This is simpler and more robust, and fixes mismatching XMM save restore
mismatches

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
25da8d84a4 avcodec/x86/lossless_audiodsp: Make scalarproduct_and_madd_int16 prototypes more similar
This is needed as the mmx code is used as fallback from the ssse3 code

Suggested-by: jamrial
Tested-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3b4ffba3af968ae702e3a44f6b5f53445efc7363)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0f642909d8 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 f2579dbb4b31e6ae731e7f5555680528ef3020ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
6252e9141b swscale/utils: Limit filter shifting so as not to read from prior the array
Fixes out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
c65a731b6f avcodec/mpegvideo_motion: Fix gmc chroma dimensions
Fixes integer overflow and out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
58096b70fa 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 fabbfaa095660982cc0bc63242c459561fa37037)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
0ae93844d0 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>
(cherry picked from commit afa92907f3c6a0c3bdad766ec8d938ee17ee1c9e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
657dc91b44 avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 05e161952954acf247e0fd1fdef00559675c4d4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
wm4
352d17086f 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 b737a2c52857b214be246ff615c6293730033cfa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
wm4
193440f566 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 56cc024220886927350cfc26ee695062ca7ecaf4)

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

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

Fixes ticket #4294.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Rong Yan
b0b6d8de7e avcodec/ppc/idctdsp.c: POWER LE support in idct_add_altivec()
also add GET_TMP2() macro

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
2f5c5767d1 avcodec/mpegvideo_enc: Fix number suffixes in rc_buffer_size calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4531e2c489d279bfc90d54ca26ed898c5b265a7f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
979a54ed18 avcodec/h264_cabac: use int instead of long for mbb_xy
The mb address fits in int

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
d11bca8043 avformat/omadec: fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1f7f5903ab49b84789af5341492afbaba808a70)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:36 +01:00
Michael Niedermayer
a3ef410b9c avformat/smacker: Fix number suffix
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 465f3705b1ef832fd6904750d018f81f9044f3ab)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
260e5c6dbe avformat/matroskadec: Fix number suffixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fc3cdb00d084222a107e61e7168903bf3d3d0b47)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
bac6554c74 avcodec/dxtory: Use LL instead of L number suffix
This is probably unneeded and normal int would be fine, but its
safer to use LL and this isnt speed relevant

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
1e366c15ed swresample/dither: Cleanup number suffixes
The <<31 case needs LL

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
675fb3a8af avformat/utils: Fix number suffixes in tb_unreliable()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b15bba2aec93776bfdc69a1bca42a4795a7d191)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
25fc0faccb doc/APIchanges: fill in more missing hash values and dates
all values before 2.5 seem to be filled in now

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
164083434e doc/APIchanges: fill in and correct some values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0d64982828aee5f3495a71050e4930fa2898ca15)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
8026606497 doc/APIchanges: Add av_find_best_pix_fmt_of_2() and av_get_pix_fmt_loss()
also add deprecation note for avcodec_get_pix_fmt_loss(), avcodec_find_best_pix_fmt_of_2()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
6ac8ac0109 doc/APIchanges: Fill in some more missing hash values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bbdd940f36662d4b6156464b1bda5131fc382465)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
f07e2ff697 swscale/input: fix rgba64 alpha non native
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f30798584fd9709e83644f831107fdc9e26b1311)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
b62b3e1a25 swscale/input: Fix alpha of YA16 input
Fixes Ticket4278

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Andreas Cadhalpun
a45b8af839 libavcodec/ppc/mpegvideoencdsp.c: fix stack smashing in pix_norm1_altivec() and pix_sum_altivec()
The vec_ste calls were mistakenly changed to vec_vsx_st in c5ca76a, which
caused stack smashing.

Changing them back fixes crashes on ppc64el, when configured with
--toolchain=hardened.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
a443b48ccf avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03abf55f252945c70f4a79eaf4d609cee4d98710)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
a45402d4c0 avformat/mpeg: do not count PES packets inside PES packets during probing
Fixes: misdetection of test2.mp3

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
0bdc64e8b9 hevc: always clip luma_log2_weight_denom
Its value shall be between 0 and 7 according to the specifications.

Bug-Id: CID 1257502
2015-02-12 17:10:35 +01:00
Martin Storsjö
5fbf63ea39 rtpdec_h263_rfc2190: Clear the stored bits if discarding buffered data
If we throw away the buffered incomplete frame, make sure to also
throw away the buffered bits of an incomplete byte at the same
time.

(cherry picked from commit df07c07b3de0a5e8890078944de1eb5cb8372ef8)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
4d74bb24e3 aacenc: correctly check returned value
(cherry picked from commit 971099ff5a85377579eb5b8d3620e283957f097e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
7f8d0cf93a swscale: check memory allocations
Bug-Id: CID 1257779
(cherry picked from commit 1dd797e3c9f179f957316a0becbec048b42df8aa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
28fba55306 opt: check memory allocation
Bug-Id: CID 1257771
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
wm4
7caee17204 avformat/utils: check for malloc failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a66893ac949864352b36b39e48c4cd72bbd81e54)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
edec2a4da3 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 c4d85fc23c100f7a27d9bad710eb153214868e27)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
65074a5dae avfilter/vf_framepack: Check and update frame_rate
The frame_rate update was missing leaving the output frame rate
wrong.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
e3b6144e0c avdevice: Use av_format_get_control_message_cb()
This is required as the location of this field could change and is
specified in libavformat not avdevice

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Vittorio Giovara
8acbba0ec3 vp8: improve memory allocation checks
Check memory earlier, check one more allocation and clean up on error.

CC: libav-stable@libav.org
Bug-Id: CID 1257773
(cherry picked from commit 014b6b416fec89777cb9cff61bcf7896eaf7cf39)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Andreas Cadhalpun
9e9cde6afa configure: enable vsx together with altivec for ppc64el
The altivec optimizations on little endian ppc64 don't work without vsx.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Michael Niedermayer
4f8814964c avcodec/hevc: Fix handling of skipped_bytes() reallocation failures
Fixes CID1260704

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
wm4
8a6770a214 qpeg: avoid pointless invalid memcpy()
If refdata was NULL, the memcpy() ended up copying the same memory
block onto itself, which is not only pointless, but also undefined
behavior.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 17:10:35 +01:00
Carl Eugen Hoyos
763e6ecf83 lavc/aarch64: Do not use the neon horizontal chroma loop filter for H.264 4:2:2.
(cherry picked from commit 4faea46bd906b3897018736208123aa36c3f45d5)
2015-02-03 23:08:15 +01:00
Andreas Cadhalpun
07d508e4f5 doc/examples: fix lib math dep for decoding_encoding
It uses at least sin().

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 05:03:04 +01:00
Michael Niedermayer
b089b58250 avformat/movenc: workaround bug in "PathScale EKOPath(tm) Compiler Suite Version 4.0.12.1"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7824dc5150c0ea44ffa7cd4d57803f9a9697e7d7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 05:01:20 +01:00
Michael Niedermayer
a7dd37169c Update for 2.5.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:37:34 +01:00
wm4
3032291b3a vp9: fix parser return values in error case
The parser must always set the out_size and out_data pointers. The API
seems to require it, and the common code in parser.c also relies on it.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
f9bbc26e69 ffmpeg: Clear error message array at init.
This avoids printing uninitialized bytes if no error message is set

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4
b895e29941 avcodec/dvdsubdec: fix accessing dangling pointers
dvdsub_decode() can call append_to_cached_buf() 2 times, the second time
with ctx->buf as argument. If the second append_to_cached_buf() reallocs
ctx->buf, the argument will be a pointer to the previous, freed block.
This can cause invalid reads at least with some fuzzed files - and
possibly with valid files.

Since packets can apparently not be larger than 64K (even if packets are
combined), just use a fixed size buffer. It will be allocated as part of
the DVDSubContext, and although some memory is "wasted", it's relatively
minimal by modern standards and should be acceptable.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4
3d71024f8a 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 bcaa9099b3648b47060e1724a97dc98b63c83702)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
James Almer
b834dc14da configure: bump year
Happy new year!
(cherry picked from commit b8db25a3338b67186837c49580fe538d63dd73c7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
d0041dc8c4 avformat/mov: Fix mixed declaration and statement warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit db27f50e0658e91758e8a17fdcf390e6bc93c1d2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
b3c082412c cmdutils: Use 64bit for file size/offset related variable in cmdutils_read_file()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 369b4cd4120bf67aa5187b6bc72574970a24ca22)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
918ed73b70 avformat/utils: Clear pointer in ff_alloc_extradata() to avoid leaving a stale pointer in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bbfca8e84b0e69abba523d665536c0135fc1c00e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
2791eba1d7 avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e70e4aca50696040cc9256ec96e5c31d9641432)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
0d3a07852c avformat/mov: use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 383c6a3a07b71981bd32d083496f5a4935f620f9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Paul B Mahol
c7a2ac6b6b lavfi: check av_strdup() return value
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 145a84717b62e086cdb5f26649ad9f1b51ef38d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Dale Curtis
0ce35b8ce8 mov: Fix negative size calculation in mov_read_default().
The previous code assumed if an atom was marked with a 64-bit
size extension, it actually had that data available. The new
code verfies there's enough data in the atom for this to be
done.

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

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ebd76a9c57558e284e94da367dd23b435e6a6d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
25312a427b 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 3859868c75313e318ebc5d0d33baada62d45dd75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Dale Curtis
9143ab0e5a mov: Fix overflow and error handling in read_tfra().
Under abnormal conditions the item_count may exceed the max
allocation size on 32-bit systems, this causes the allocated
size to overflow and become too small for the given count.

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

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

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

positive return code and use of _array functions by commiter

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

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

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
2015-01-09 17:19:10 +01:00
wm4
e0a12b3dc3 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 c9151de7c42553bb145be608df8513c1287f1f24)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
252ba4a925 avfilter/vf_sab: fix filtering tiny images
Fixes out of array reads

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
5bb31e856d avformat/flvdec: Increase string array size
Fixes parsing httphostheader of Scarlatti\,\ Pieter-Jan\ Belder\ -\ Sonata\ K113\ in\ A\ major\ -\ Alle.flv

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

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer
68c6347089 avformat/cdxl: Fix integer overflow of image_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3eb5cbe0c50d0a0bbe10bcabbd6b16d73d93c128)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:09 +01:00
Michael Niedermayer
bcd7f35717 avformat/segment: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 68fa549230af35179df2a2af2bdb84ee6c825bed)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:09 +01:00
Martin Storsjö
93cbdcd4d3 libavformat: Build hevc.o when building the RTP muxer
The RTP muxer enables the actual codepaths within sdp.c,
which depend on hevc.o since e5cfc8fd.

This fixes builds with --disable-everything --enable-muxer=rtp.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit fccfc22d1f304aef42a0b960e4c1d55ce67107f5)
2015-01-09 00:50:31 -03:00
Michael Niedermayer
959ab06c68 Changelog: update for 2.5.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-23 04:28:09 +01:00
Michael Niedermayer
46db3121c6 update for 2.5.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:41:27 +01:00
Michael Niedermayer
c96c755320 Makefile: add dependencies which require ffversion.h
Without this ffversion.h could sometimes be built too late

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:56 +01:00
Michael Niedermayer
9f8cdd520b Add FFMPEG_VERSION into the binary libs
This simplifies identifying from which revision a binary of a lib came from

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:56 +01:00
Anton Khirnov
f5631d23e0 mmvideo: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 2.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
See: 8b0e96e1f21b761ca15dbb470cd619a1ebf86c3e
These should be redundant, but are backported for saftey anyway
2014-12-22 03:17:56 +01:00
Anton Khirnov
50f4543c6b jvdec: check frame dimensions
The frame size must be set by the caller and each dimension must be a
multiple of 8.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
See: 105654e376a736d243aef4a1d121abebce912e6b
These should be redundant, but are backported for saftey anyway
2014-12-22 03:17:56 +01:00
Michael Niedermayer
1344e91f33 avcodec/indeo3: ensure offsets are non negative
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 368642361f3a589d7b0c23ea327d988edb434e3f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
f13e6ec7a6 avcodec/h264: Check *log2_weight_denom
Fixes undefined behavior
Fixes: signal_sigsegv_14768d2_2248_cov_3629497219_h264_h264___pi_20070614T182942.h264
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61296d41e2de3b41304339e4631dd44c2e15f805)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
bf2c9e1ad4 avcodec/hevc_ps: Check diff_cu_qp_delta_depth
Fixes undefined behavior
Fixes: asan_static-oob_17aa046_582_cov_1577759978_DBLK_G_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3281fa892599d71b4dc298a426af8296419cd90e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
0663aab1d9 avcodec/h264: Clear delayed_pic on deallocation
Fixes use of freed memory

Fixes: case5_av_frame_copy_props.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e8714f6f93d1a32f4e4655209960afcf4c185214)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
e911f125fc avcodec/hevc: clear filter_slice_edges() on allocation
This avoids use of uninitialized memory
Fixes: asan_static-oob_17aa046_582_cov_212287884_DBLK_G_VIXS_1.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8aa8d12554868c32436750f881954193087219c8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
5aead5ee05 avcodec/dcadec: Check that the added xch channel isnt already there
Fixes null pointer dereference
Fixes: signal_sigsegv_369609d_623_cov_2008234281_ES_6.1_16bit.dts
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7d593495e42e92693cc8f3ce9b42cf3edcea377a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3a5b749d7c 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 3305acdc92fa37869f160a11a87741c8a0de0454)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
4b4d0b0290 avcodec/h264: make the first field of H264Context an AVClass
Fixes use of freed memory
Fixes: asan_heap-uaf_3660f67_757_cov_1257014655_Hi422FR1_SONY_A.jsv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f3b5b139ad853b6f69c6a0b036815a60e7b3f261)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
c9b25252cb 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>
(cherry picked from commit 2a983ff7fe076ae93926eb33cfb44ca49183dacc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
4400385d5f avformat/mov: fix integer overflow of size
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit be9ce6e10a8d53b8bc346c9337d75a5a30631a2a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
d85e25fe0b avformat/mov: check atom nesting depth
Fixes call stack overflow
Fixes: case1_call_stack_overflow.mp4
Found-by: Michal Zalewski <lcamtuf@coredump.cx>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit caa7a3914f499f74b3ee346f26d598ebdc0ec210)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3d1972d182 avcodec/utvideodec: Fix handling of slice_height=0
Fixes out of array accesses
Fixes: asan_heap-oob_25bcd7e_3783_cov_3553517262_utvideo_rgba_median.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3881606240953b9275a247a1c98a567f3c44890f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
71b1abe638 avcodec/xface: Add asserts to limit nb_words from becoming too large
Approved-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 211200e0c0efa48b2815ce93fda10dab43526d1b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
991ef3a67e avcodec/xface: correct the XFACE_MAX_* values
Fixes out of array access

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
b850b01533 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 3030fb7e0d41836f8add6399e9a7c7b740b48bfd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
23a17b4a3d avformat/flvdec: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 91ea466551c148bd897706a1b6a168e783761a06)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
3a8ad4b878 avformat/hdsenc: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 16d763fa45b95783c6770edc559769d9a83d6a10)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Michael Niedermayer
b85a939633 configure: create the tests directory like the doc directory
This fixes an issue where the tests directory is not created for out of tree
builds before its needed

Tested-by: Dave Yeo <daveryeo@telus.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e631872f13b6be0583603d45a11e53319754bc8d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 03:17:55 +01:00
Clément Bœsch
7e130ca5b4 avformat/rsd: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.

(cherry picked from commit edbbb11488e1fce9b9703535936d2e1731e2e318)
2014-12-19 18:01:31 -03:00
Clément Bœsch
f295f9488a avformat/apngdec: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.

(cherry picked from commit d60fb4f7946272d2ef39703762b54c5f3a1b5789)
2014-12-19 18:00:40 -03:00
Michael Niedermayer
2c01dd2ea5 Update Changelog for 2.5.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 23:52:03 +01:00
Michael Niedermayer
5e26152ee4 Update for FFmpeg 2.5.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 15:30:31 +01:00
wm4
135c733125 lavu/frame: fix malloc error path in av_frame_copy_props()
The error path frees all side data, but forgets to reset the side data
count. This can blow up later in av_frame_unref() and free_side_data().

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-15 05:32:36 +01:00
Michael Niedermayer
3b3a3c3d44 avformat/utils: Do not update programs streams from program-less streams in update_wrap_reference()
Fixes Ticket3686

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 20:58:33 +01:00
Michael Niedermayer
13244abcd3 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 ed86dbd05d61363dc1c0d33f3267e2177c985fdd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 17:42:16 +01:00
Rob Sykes
9783d5bfda swresample/soxr_resample: fix error handling
Fixes CID1257659

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-13 22:20:16 +01:00
Michael Niedermayer
0e4efad93c avformat/flvdec: fix potential use of uninitialized variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0fadbd3623cf9132832f48810c0edb93aa63f51b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-10 13:42:29 +01:00
Michael Niedermayer
0103bc67fd avformat/crypto: fix key vs iv typo
Fixes Ticket 4167

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 20:08:03 +01:00
Moritz Barsnick
d5af3fb1c5 configure: use use_pkg_config() instead of check_pkg_config() for libsmbclient
This ensures that the CFLAGS and LDFLAGS are actually applied.
Fixes an incorrect change introduced with the clean-up in commit
cfcaf6b38e39ed6e788abb1a5a44f23660dce2f6.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 754f4957d7a7e5be0df0e9de1d31aebeecdc4476)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 01:04:32 +01:00
Rong Yan
6ec5a199ea avcodec/ppc/vp3dsp_altivec: POWER LE support to vp3_idct_add_altivec()
add GET_VDST16() macro

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

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

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

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

Fixes ticket #4162.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-07 23:04:23 +01:00
Piotr Fusik
542332e523 doc/examples/filtering_video: fix frame rate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c99e5191ab846d4897dfc565ba446ec960e04aa9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-05 17:36:19 +01:00
Michael Niedermayer
aa24dd487f avcodec/mpegaudiodec_template: only allocate fdsp when its used
Fixes memleak

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-05 05:16:14 +01:00
Michael Niedermayer
3bcd1daad7 doc/examples/transcoding: check encoder before using it
Fixes null pointer exception

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 19:08:32 +01:00
Michael Niedermayer
91f88eab32 MAINTAINERS: add 2.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a4f21a8dd9d8b327334d706a96c0cb5c41bd82b6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 14:48:20 +01:00
Rong Yan
aac467ae17 avcodec/ppc/vp8dsp_altivec.c: POWER LE support put_vp8_epel_h_altivec_core() put_vp8_epel_v_altivec_core() put_vp8_pixels16_altivec() add marcos GET_PIXHL() GET_OUTER() LOAD_HL()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d23e8832486f0a37c7ad708b504b723bcfa2f71d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 14:48:19 +01:00
Rong Yan
968e733b2e avcodec/ppc/vc1dsp_altivec: add POWER LE support to vc1_inv_trans_8x4_altivec()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 36cd2bcbc343c299241dc7275cb85cbc3fc6b8ad)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 12:09:38 +01:00
Timothy Gu
192d46e6d1 Update RELEASE_NOTES
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 06:06:18 +01:00
Timothy Gu
bb8614cb7b Changelog/RELEASE_NOTES: Add APNG decoder
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2014-12-04 06:06:07 +01:00
Michael Niedermayer
d9bdf7d9ae Changelog: release is 2.5 not "next"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 02:16:55 +01:00
Michael Niedermayer
a588e1e560 avcodec/aacdec: reduce noisiness of missing channel elements
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5fe026f2bda68a129d70b9609c4902917db9ca2e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 01:58:32 +01:00
Carl Eugen Hoyos
36e7385d0e Fix standalone compilation of the iec61883 input device.
(cherry picked from commit 963aa1daf88066d43c7495803b870800c5faaa4d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 01:58:28 +01:00
Michael Niedermayer
5108323aa9 Update for 2.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-04 00:47:17 +01:00
226 changed files with 1822 additions and 708 deletions

218
Changelog
View File

@ -1,7 +1,221 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version <next>:
version 2.5.7
- avformat/nutdec: Fix recovery when immedeately after seeking a failure happens
- nutdec: fix memleaks on error in nut_read_header
- rtpenc_jpeg: handle case of picture dimensions not dividing by 8
- avformat/mov: Fix parsing short loci
- avcodec/shorten: Fix code depending on signed overflow behavior
- avcodec/proresdec2: Reset slice_count on deallocation
- ffmpeg_opt: Fix -timestamp parsing
- hevc: make avcodec_decode_video2() fail if get_format() fails
- avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE
- swr: fix alignment issue caused by 8ch sse functions
- libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list on x86_64, because it isn't implicitly included when PIC is on.
- aacdec: don't return frames without data
- avformat/matroskadec: Cleanup error handling for bz2 & zlib
- avformat/nutdec: Fix use of uinitialized value
- tools/graph2dot: use larger data types than int for array/string sizes
- id3v2: catch avio_read errors in check_tag
- aacsbr: break infinite loop in sbr_hf_calc_npatches
- diracdec: avoid overflow of bytes*8 in decode_lowdelay
- diracdec: prevent overflow in data_unit_size check
- avidec: avoid infinite loop due to negative ast->sample_size
- pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
- avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow and undefined behavior in fate
- xcbgrab: Validate the capture area
- xcbgrab: Do not assume the non shm image data is always available
- avfilter/lavfutils: disable frame threads when decoding a single image
- nutdec: fix illegal count check in decode_main_header
- ffmpeg: remove incorrect network deinit
- OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
- apedec: set s->samples only when init_frame_decoder succeeded
- swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF()
- libvpxenc: only set noise reduction w/vp8
- tests/fate-run: do not attempt to parse tiny_psnrs output if it failed
- alac: reject rice_limit 0 if compression is used
- alsdec: only adapt order for positive max_order
- alsdec: check sample pointer range in revert_channel_correlation
- tests: drop bc dependency
- fate: Include branch information in the payload header
version 2.5.6
- avcodec/atrac3plusdsp: fix on stack alignment
- ac3: validate end in ff_ac3_bit_alloc_calc_mask
- aacpsy: avoid psy_band->threshold becoming NaN
- aasc: return correct buffer size from aasc_decode_frame
- msrledec: use signed pixel_ptr in msrle_decode_pal4
- swresample: Allow reinitialization without ever setting channel layouts (cherry picked from commit 80a28c7509a11114e1aea5b208d56c6646d69c07)
- swresample: Allow reinitialization without ever setting channel counts
- avcodec/h264: Do not fail with randomly truncated VUIs
- avcodec/h264_ps: Move truncation check from VUI to SPS
- avcodec/h264: Be more tolerant to changing pps id between slices
- avcodec/aacdec: Fix storing state before PCE decode
- avcodec/h264: reset the counts in the correct context
- avcodec/h264_slice: Do not reset mb_aff_frame per slice
- avcodec/h264: finish previous slices before switching to single thread mode
- avcodec/h264: Fix race between slices where one overwrites data from the next
- avcodec/h264_refs: Do not set reference to things which do not exist
- avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode
- h264: avoid unnecessary calls to get_format
- avcodec/msrledec: restructure msrle_decode_pal4() based on the line number instead of the pixel pointer
version 2.5.5:
- vp9: make above buffer pointer 32-byte aligned.
- avcodec/dnxhddec: Check that the frame is interlaced before using cur_field
- avformat/mov: Disallow ".." in dref unless use_absolute_path is set
- avformat/mov: Check for string truncation in mov_open_dref()
- avformat/mov: Use sizeof(filename) instead of a literal number
- eac3dec: fix scaling
- ac3_fixed: fix computation of spx_noise_blend
- ac3_fixed: fix out-of-bound read
- ac3dec_fixed: always use the USE_FIXED=1 variant of the AC3DecodeContext
- avcodec/012v: redesign main loop
- avcodec/012v: Check dimensions more completely
- asfenc: fix leaking asf->index_ptr on error
- avcodec/options_table: remove extradata_size from the AVOptions table
- ffmdec: limit the backward seek to the last resync position
- ffmdec: make sure the time base is valid
- ffmdec: fix infinite loop at EOF
- ffmdec: initialize f_cprv, f_stvi and f_stau
- avformat/rm: limit packet size
- avcodec/webp: validate the distance prefix code
- avcodec/rv10: check size of s->mb_width * s->mb_height
- eamad: check for out of bounds read
- mdec: check for out of bounds read
- arm: Suppress tags about used cpu arch and extensions
- aic: Fix decoding files with odd dimensions
- avcodec/tiff: move bpp check to after "end:"
- mxfdec: Fix the error handling for when strftime fails
- avcodec/opusdec: Fix delayed sample value
- avcodec/opusdec: Clear out pointers per packet
- avcodec/utils: Align YUV411 by as much as the other YUV variants
- vp9: fix segmentation map retention with threading enabled.
- webp: ensure that each transform is only used once
- doc/protocols/tcp: fix units of listen_timeout option value, from microseconds to milliseconds
- fix VP9 packet decoder returning 0 instead of the used data size
- avformat/flvenc: check that the codec_tag fits in the available bits
- avcodec/utils: use correct printf specifier in ff_set_sar
- avutil/imgutils: correctly check for negative SAR components
- swscale/utils: clear formatConvBuffer on allocation
- avformat/bit: only accept the g729 codec and 1 channel
- avformat/bit: check that pkt->size is 10 in write_packet
- avformat/adxdec: check avctx->channels for invalid values
- avformat/adxdec: set avctx->channels in adx_read_header
- Fix buffer_size argument to init_put_bits() in multiple encoders.
- mips/acelp_filters: fix incorrect register constraint
- avcodec/hevc_ps: Sanity checks for some log2_* values
- avcodec/zmbv: Check len before reading in decode_frame()
- avcodec/h264: Only reinit quant tables if a new PPS is allowed
- avcodec/snowdec: Fix ref value check
- swscale/utils: More carefully merge and clear coefficients outside the input
- avcodec/a64multienc: Assert that the Packet size does not grow
- avcodec/a64multienc: simplify frame handling code
- avcodec/a64multienc: fix use of uninitialized values in to_meta_with_crop
- avcodec/a64multienc: initialize mc_meta_charset to zero
- avcodec/a64multienc: don't set incorrect packet size
- avcodec/a64multienc: use av_frame_ref instead of copying the frame
- avcodec/x86/mlpdsp_init: Simplify mlp_filter_channel_x86()
- h264: initialize H264Context.avctx in init_thread_copy
- wtvdec: fix integer overflow resulting in errors with large files
- avcodec/gif: fix off by one in column offsetting finding
version 2.5.4:
- avcodec/arm/videodsp_armv5te: Fix linking failure with shared libs
- avcodec/mjpegdec: Skip blocks which are outside the visible area
- avcodec/h264_slice: ignore SAR changes in slices after the first
- avcodec/h264_slice: Check picture structure before setting the related fields
- avcodec/h264_slice: Do not change frame_num after the first slice
- avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
- avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
- avcodec/h264: Be more strict on rejecting pps/sps changes
- avcodec/h264: Be more strict on rejecting pps_id changes
- avcodec/h264_ps: More completely check the bit depths
- avformat/thp: Check av_get_packet() for failure not only for partial output
- swscale/utils: Limit filter shifting so as not to read from prior the array
- avcodec/mpegvideo_motion: Fix gmc chroma dimensions
- avcodec/mjpegdec: Check number of components for JPEG-LS
- avcodec/mjpegdec: Check escape sequence validity
- avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
- avformat/mpc8: fix broken pointer math
- avformat/mpc8: fix hang with fuzzed file
- avformat/tta: fix crash with corrupted files
- avcodec/ppc/idctdsp.c: POWER LE support in idct_add_altivec()
- swscale/input: fix rgba64 alpha non native
- swscale/input: Fix alpha of YA16 input
- libavcodec/ppc/mpegvideoencdsp.c: fix stack smashing in pix_norm1_altivec() and pix_sum_altivec()
- avformat/rmdec: Check for overflow in ff_rm_read_mdpr_codecdata()
- avformat/mpeg: do not count PES packets inside PES packets during probing
- hevc: always clip luma_log2_weight_denom
- rtpdec_h263_rfc2190: Clear the stored bits if discarding buffered data
- aacenc: correctly check returned value
- swscale: check memory allocations
- opt: check memory allocation
- avformat/utils: check for malloc failure
- avcodec/flac_parser: fix handling EOF if no headers are found
- avfilter/vf_framepack: Check and update frame_rate
- vp8: improve memory allocation checks
- configure: enable vsx together with altivec for ppc64el
- avcodec/hevc: Fix handling of skipped_bytes() reallocation failures
- qpeg: avoid pointless invalid memcpy()
version 2.5.3:
- vp9: fix parser return values in error case
- ffmpeg: Clear error message array at init.
- avcodec/dvdsubdec: fix accessing dangling pointers
- avcodec/dvdsubdec: error on bitmaps with size 0
- cmdutils: Use 64bit for file size/offset related variable in cmdutils_read_file()
- mov: Fix negative size calculation in mov_read_default().
- avformat/mov: fix integer overflow in mov_read_udta_string()
- mov: Fix overflow and error handling in read_tfra().
- mov: Avoid overflow with mov_metadata_raw()
- avcodec/dvdsubdec: fix out of bounds accesses
- avfilter/vf_sab: fix filtering tiny images
- avformat/flvdec: Increase string array size
- avformat/flvdec: do not inject dts=0 metadata packets which failed to be parsed into a new data stream
- avformat/cdxl: Fix integer overflow of image_size
- libavformat: Build hevc.o when building the RTP muxer
version 2.5.2:
- avcodec/indeo3: ensure offsets are non negative
- avcodec/h264: Check *log2_weight_denom
- avcodec/hevc_ps: Check diff_cu_qp_delta_depth
- avcodec/h264: Clear delayed_pic on deallocation
- avcodec/hevc: clear filter_slice_edges() on allocation
- avcodec/dcadec: Check that the added xch channel isnt already there
- avcodec/indeo3: use signed variables to avoid underflow
- swscale: increase yuv2rgb table headroom
- avformat/mov: fix integer overflow of size
- avformat/mov: check atom nesting depth
- avcodec/utvideodec: Fix handling of slice_height=0
- avcodec/xface: correct the XFACE_MAX_* values
- avcodec/vmdvideo: Check len before using it in method 3
- configure: create the tests directory like the doc directory
- mmvideo: check frame dimensions
- jvdec: check frame dimensions
version 2.5.1:
- lavu/frame: fix malloc error path in av_frame_copy_props()
- avformat/aviobuf: Check that avio_seek() target is non negative
- swresample/soxr_resample: fix error handling
- avformat/flvdec: fix potential use of uninitialized variables
- avformat/crypto: fix key vs iv typo
- configure: use use_pkg_config() instead of check_pkg_config() for libsmbclient
- avcodec/ppc/vp3dsp_altivec: POWER LE support to vp3_idct_add_altivec()
- avformat/matroskadec: fix handling of recursive SeekHead elements
- doc/examples/filtering_video: fix frame rate
- avcodec/mpegaudiodec_template: only allocate fdsp when its used
- doc/examples/transcoding: check encoder before using it
- update MAINTAINERS file
- POWER LE support in put_vp8_epel_h_altivec_core() put_vp8_epel_v_altivec_core() put_vp8_pixels16_altivec()
- POWER LE support in vc1_inv_trans_8x4_altivec()
version 2.5:
- HEVC/H.265 RTP payload format (draft v6) packetizer
- SUP/PGS subtitle demuxer
- ffprobe -show_pixel_formats option
@ -16,7 +230,7 @@ version <next>:
- creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
- WebP muxer with animated WebP support
- zygoaudio decoding support
- APNG demuxer
- APNG decoder and demuxer
- postproc visualization support

View File

@ -537,6 +537,7 @@ x86 Michael Niedermayer
Releases
========
2.5 Michael Niedermayer
2.4 Michael Niedermayer
2.2 Michael Niedermayer
1.2 Michael Niedermayer

View File

@ -112,7 +112,7 @@ endef
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
ffprobe.o cmdutils.o : libavutil/ffversion.h
ffprobe.o cmdutils.o libavcodec/utils.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
$(CP) $< $@

View File

@ -1 +1 @@
2.4.git
2.5.7

View File

@ -2,9 +2,13 @@
│ RELEASE NOTES for FFmpeg 2.5 "Bohr" │
└────────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 2.5 "Bohr", just 2.5 months
after the release of 2.4. Since this wasn't a long time ago, the Changelog
is a bit short this time.
The FFmpeg Project proudly presents FFmpeg 2.5 "Bohr", 2.5 months after the
release of 2.4.
The most important new features are AVFoundation screen-grabbing support,
animated WebP decoding support, and Animated PNG support. In addition, many
exciting features for video streaming are also implemented, including MPEG-
DASH fragmenting muxer, HEVC RTP payload muxer, and UDP Lite support.
As usual, if you have any question on this release or any FFmpeg related
topic, feel free to join us on the #ffmpeg IRC channel (on
@ -56,6 +60,7 @@
• libutvideo YUV 4:2:2 10bit support
• animated WebP decoding support
• zygoaudio decoding support
• APNG decoder
┌────────────────────────────┐
│ libavdevice │
@ -72,7 +77,8 @@
• SUP/PGS subtitle demuxer
• STL subtitle demuxer
• UDP-Lite support (RFC 3828)
• creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
• MPEG-DASH segmenting muxer, which allows creating DASH compatible
fragmented MP4
• WebP muxer
• APNG demuxer
@ -93,7 +99,3 @@
└────────────────────────────┘
• visualization support
┌────────────────────────────┐
│ ⚠ Behaviour changes │
└────────────────────────────┘

View File

@ -1860,7 +1860,7 @@ int read_yesno(void)
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
{
int ret;
int64_t ret;
FILE *f = av_fopen_utf8(filename, "rb");
if (!f) {

View File

@ -22,6 +22,7 @@
#include "libavutil/time.h"
#include "libavutil/log.h"
#include "libavutil/opencl.h"
#include "libavutil/avstring.h"
#include "cmdutils.h"
typedef struct {
@ -238,7 +239,8 @@ int opt_opencl_bench(void *optctx, const char *opt, const char *arg)
devices[count].platform_idx = i;
devices[count].device_idx = j;
devices[count].runtime = score;
strcpy(devices[count].device_name, device_node->device_name);
av_strlcpy(devices[count].device_name, device_node->device_name,
sizeof(devices[count].device_name));
count++;
}
}

15
configure vendored
View File

@ -1635,7 +1635,6 @@ HEADERS_LIST="
asm_types_h
cdio_paranoia_h
cdio_paranoia_paranoia_h
CL_cl_h
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
dev_ic_bt8xx_h
@ -1761,6 +1760,7 @@ SYSTEM_FUNCS="
TOOLCHAIN_FEATURES="
as_dn_directive
as_func
as_object_arch
asm_mod_q
attribute_may_alias
attribute_packed
@ -4413,7 +4413,7 @@ unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
if [ "$cpu" = "power7" ] || [ "$cpu" = "power8" ] ;then
if [ "$cpu" = "power7" ] || [ "$cpu" = "power8" ] || enabled ppc64; then
if ! enabled bigendian && enabled altivec ;then
enable vsx
fi
@ -4520,6 +4520,11 @@ EOF
check_as <<EOF && enable as_dn_directive
ra .dn d0.i16
.unreq ra
EOF
# llvm's integrated assembler supports .object_arch from llvm 3.5
[ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
.object_arch armv4
EOF
[ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
@ -4756,7 +4761,6 @@ check_func_headers glob.h glob
enabled xlib &&
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
check_header cl/cl.h
check_header direct.h
check_header dlfcn.h
check_header dxva.h
@ -4883,7 +4887,7 @@ enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { check_pkg_config smbclient libsmbclient.h smbc_init ||
enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
require smbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
@ -5678,7 +5682,7 @@ cat > $TMPH <<EOF
#define FFMPEG_CONFIG_H
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
#define FFMPEG_LICENSE "$(c_escape $license)"
#define CONFIG_THIS_YEAR 2014
#define CONFIG_THIS_YEAR 2015
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
@ -5706,6 +5710,7 @@ enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
mkdir -p doc
mkdir -p tests
echo "@c auto-generated by configure" > doc/config.texi
print_config ARCH_ "$config_files" $ARCH_LIST

View File

@ -200,7 +200,7 @@ API changes, most recent first:
Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing
it
2014-06-10 - xxxxxxx - lavf 55.43.100 - avformat.h
2014-06-10 - 5482780 - lavf 55.43.100 - avformat.h
New field int64_t max_analyze_duration2 instead of deprecated
int max_analyze_duration.
@ -224,7 +224,7 @@ API changes, most recent first:
Add strict_std_compliance and related AVOptions to support experimental
muxing.
2014-05-26 - xxxxxxx - lavu 52.87.100 - threadmessage.h
2014-05-26 - 55cc60c - lavu 52.87.100 - threadmessage.h
Add thread message queue API.
2014-05-26 - c37d179 - lavf 55.41.100 - avformat.h
@ -234,7 +234,7 @@ API changes, most recent first:
Add av_stream_get_side_data() to access stream-level side data
in the same way as av_packet_get_side_data().
2014-05-xx - xxxxxxx - lavu 52.86.100 - fifo.h
2014-05-20 - 7336e39 - lavu 52.86.100 - fifo.h
Add av_fifo_alloc_array() function.
2014-05-19 - ef1d4ee / bddd8cb - lavu 52.85.100 / 53.15.0 - frame.h, display.h
@ -266,7 +266,7 @@ API changes, most recent first:
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
Add AV_PIX_FMT_VDA for new-style VDA acceleration.
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h
2014-05-07 - 351f611 - lavu 52.82.100 - fifo.h
Add av_fifo_freep() function.
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
@ -288,10 +288,14 @@ API changes, most recent first:
Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing
reference-counted frames to encoders.
2014-04-30 - 617e866 - lavu 52.81.100 - pixdesc.h
Add av_find_best_pix_fmt_of_2(), av_get_pix_fmt_loss()
Deprecate avcodec_get_pix_fmt_loss(), avcodec_find_best_pix_fmt_of_2()
2014-04-29 - 1bf6396 - lavc 55.60.100 - avcodec.h
Add AVCodecDescriptor.mime_types field.
2014-04-29 - xxxxxxx - lavu 52.80.0 - hash.h
2014-04-29 - b804eb4 - lavu 52.80.100 - hash.h
Add av_hash_final_bin(), av_hash_final_hex() and av_hash_final_b64().
2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h
@ -303,7 +307,7 @@ API changes, most recent first:
2014-04-17 - a8d01a7 / 0983d48 - lavu 53.12.0 / 52.77.100 - crc.h
Add AV_CRC_16_ANSI_LE crc variant.
2014-04-XX - xxxxxxx - lavf xx.xx.1xx - avformat.h
2014-04-15 - ef818d8 - lavf 55.37.101 - avformat.h
Add av_format_inject_global_side_data()
2014-04-12 - 4f698be - lavu 52.76.100 - log.h
@ -383,7 +387,7 @@ API changes, most recent first:
2014-02-19 - f4c8d00 / 6bb8720 - lavu 52.64.101 / 53.3.1 - opt.h
Deprecate unused AV_OPT_FLAG_METADATA.
2014-02-xx - xxxxxxx - lavd 55.10.100 - avdevice.h
2014-02-16 - 81c3f81 - lavd 55.10.100 - avdevice.h
Add avdevice_list_devices() and avdevice_free_list_devices()
2014-02-16 - db3c970 - lavf 55.33.100 - avio.h
@ -424,7 +428,7 @@ API changes, most recent first:
2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h
Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags().
2014-01-19 - xxxxxxx - lavu 52.63.100 - rational.h
2014-01-19 - 3532dd5 - lavu 52.63.100 - rational.h
Add av_make_q() function.
2014-01-05 - 4cf4da9 / 5b4797a - lavu 52.62.100 / 53.2.0 - frame.h

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 = 2.5.7
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55

View File

@ -29,6 +29,7 @@ OBJS=$(addsuffix .o,$(EXAMPLES))
# the following examples make explicit use of the math library
avcodec: LDLIBS += -lm
decoding_encoding: LDLIBS += -lm
muxing: LDLIBS += -lm
resampling_audio: LDLIBS += -lm

View File

@ -90,6 +90,7 @@ static int init_filters(const char *filters_descr)
AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
AVRational time_base = fmt_ctx->streams[video_stream_index]->time_base;
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
filter_graph = avfilter_graph_alloc();
@ -102,7 +103,7 @@ static int init_filters(const char *filters_descr)
snprintf(args, sizeof(args),
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
dec_ctx->time_base.num, dec_ctx->time_base.den,
time_base.num, time_base.den,
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",

View File

@ -116,6 +116,10 @@ static int open_output_file(const char *filename)
|| dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
/* in this example, we choose transcoding to same codec */
encoder = avcodec_find_encoder(dec_ctx->codec_id);
if (!encoder) {
av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n");
return AVERROR_INVALIDDATA;
}
/* In this example, we transcode to same properties (picture size,
* sample rate etc.). These properties can be changed for output

View File

@ -298,7 +298,7 @@ FFmpeg has a @url{http://ffmpeg.org/ffmpeg-protocols.html#concat,
@code{concat}} protocol designed specifically for that, with examples in the
documentation.
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to concatenate
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow one to concatenate
video by merely concatenating the files containing them.
Hence you may concatenate your multimedia files by first transcoding them to

View File

@ -71,7 +71,7 @@ the HTTP server (configured through the @option{HTTPPort} option), and
configuration file.
Each feed is associated to a file which is stored on disk. This stored
file is used to allow to send pre-recorded data to a player as fast as
file is used to send pre-recorded data to a player as fast as
possible when new content is added in real-time to the stream.
A "live-stream" or "stream" is a resource published by

View File

@ -253,10 +253,14 @@ Possible flags for this option are:
@item sse4.1
@item sse4.2
@item avx
@item avx2
@item xop
@item fma3
@item fma4
@item 3dnow
@item 3dnowext
@item bmi1
@item bmi2
@item cmov
@end table
@item ARM
@ -267,6 +271,13 @@ Possible flags for this option are:
@item vfp
@item vfpv3
@item neon
@item setend
@end table
@item AArch64
@table @samp
@item armv8
@item vfp
@item neon
@end table
@item PowerPC
@table @samp

View File

@ -3378,7 +3378,7 @@ Set number overlapping pixels for each block. Since the filter can be slow, you
may want to reduce this value, at the cost of a less effective filter and the
risk of various artefacts.
If the overlapping value doesn't allow to process the whole input width or
If the overlapping value doesn't permit processing the whole input width or
height, a warning will be displayed and according borders won't be denoised.
Default value is @var{blocksize}-1, which is the best possible setting.

View File

@ -23,7 +23,7 @@ Reduce buffering.
@item probesize @var{integer} (@emph{input})
Set probing size in bytes, i.e. the size of the data to analyze to get
stream information. A higher value will allow to detect more
stream information. A higher value will enable detecting more
information in case it is dispersed into the stream, but will increase
latency. Must be an integer not lesser than 32. It is 5000000 by default.
@ -67,7 +67,7 @@ Default is 0.
@item analyzeduration @var{integer} (@emph{input})
Specify how many microseconds are analyzed to probe the input. A
higher value will allow to detect more accurate information, but will
higher value will enable detecting more accurate information, but will
increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
@item cryptokey @var{hexadecimal string} (@emph{input})

View File

@ -1,7 +1,7 @@
@chapter Input Devices
@c man begin INPUT DEVICES
Input devices are configured elements in FFmpeg which allow to access
Input devices are configured elements in FFmpeg which enable accessing
the data coming from a multimedia device attached to your system.
When you configure your FFmpeg build, all the supported input devices

View File

@ -135,8 +135,6 @@ You will need the following prerequisites:
(if using MSVC 2012 or earlier)
@item @uref{http://www.mingw.org/, MSYS}
@item @uref{http://yasm.tortall.net/, YASM}
@item @uref{http://gnuwin32.sourceforge.net/packages/bc.htm, bc for Windows} if
you want to run @uref{fate.html, FATE}.
@end itemize
To set up a proper environment in MSYS, you need to run @code{msys.bat} from
@ -283,7 +281,7 @@ binutils, gcc4-core, make, git, mingw-runtime, texinfo
In order to run FATE you will also need the following "Utils" packages:
@example
bc, diffutils
diffutils
@end example
If you want to build FFmpeg with additional libraries, download Cygwin

View File

@ -1081,8 +1081,8 @@ Set raise error timeout, expressed in microseconds.
This option is only relevant in read mode: if no data arrived in more
than this time interval, raise error.
@item listen_timeout=@var{microseconds}
Set listen timeout, expressed in microseconds.
@item listen_timeout=@var{milliseconds}
Set listen timeout, expressed in milliseconds.
@end table
The following example shows how to setup a listening TCP connection

View File

@ -844,7 +844,7 @@ Return 1.0 if @var{x} is +/-INFINITY, 0.0 otherwise.
Return 1.0 if @var{x} is NAN, 0.0 otherwise.
@item ld(var)
Allow to load the value of the internal variable with number
Load the value of the internal variable with number
@var{var}, which was previously stored with st(@var{var}, @var{expr}).
The function returns the loaded value.
@ -912,7 +912,7 @@ Compute the square root of @var{expr}. This is equivalent to
Compute expression @code{1/(1 + exp(4*x))}.
@item st(var, expr)
Allow to store the value of the expression @var{expr} in an internal
Store the value of the expression @var{expr} in an internal
variable. @var{var} specifies the number of the variable where to
store the value, and it is a value ranging from 0 to 9. The function
returns the value stored in the internal variable.

View File

@ -352,7 +352,6 @@ void term_init(void)
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
}
#endif
avformat_network_deinit();
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
@ -2521,7 +2520,7 @@ static int transcode_init(void)
AVFormatContext *oc;
OutputStream *ost;
InputStream *ist;
char error[1024];
char error[1024] = {0};
int want_sdp = 1;
for (i = 0; i < nb_filtergraphs; i++) {
@ -2620,11 +2619,13 @@ static int transcode_init(void)
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
enc_ctx->field_order = dec_ctx->field_order;
enc_ctx->extradata = av_mallocz(extra_size);
if (!enc_ctx->extradata) {
return AVERROR(ENOMEM);
if (dec_ctx->extradata_size) {
enc_ctx->extradata = av_mallocz(extra_size);
if (!enc_ctx->extradata) {
return AVERROR(ENOMEM);
}
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
}
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
enc_ctx->extradata_size= dec_ctx->extradata_size;
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;

View File

@ -2825,7 +2825,7 @@ const OptionDef options[] = {
{ "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
"set the input ts scale", "scale" },
{ "timestamp", HAS_ARG | OPT_PERFILE, { .func_arg = opt_recording_timestamp },
{ "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
"set the recording timestamp ('now' to set the current time)", "time" },
{ "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
"add metadata", "string=string" },

View File

@ -38,15 +38,15 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx)
static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
int line = 0, ret;
int line, ret;
const int width = avctx->width;
AVFrame *pic = data;
uint16_t *y, *u, *v;
const uint8_t *line_end, *src = avpkt->data;
int stride = avctx->width * 8 / 3;
if (width == 1) {
av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n");
if (width <= 1 || avctx->height <= 0) {
av_log(avctx, AV_LOG_ERROR, "Dimensions %dx%d not supported.\n", width, avctx->height);
return AVERROR_INVALIDDATA;
}
@ -67,45 +67,45 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
y = (uint16_t *)pic->data[0];
u = (uint16_t *)pic->data[1];
v = (uint16_t *)pic->data[2];
line_end = avpkt->data + stride;
for (line = 0; line < avctx->height; line++) {
uint16_t y_temp[6] = {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000};
uint16_t u_temp[3] = {0x8000, 0x8000, 0x8000};
uint16_t v_temp[3] = {0x8000, 0x8000, 0x8000};
int x;
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
while (line++ < avctx->height) {
while (1) {
uint32_t t = AV_RL32(src);
for (x = 0; x < width; x += 6) {
uint32_t t;
if (width - x < 6 || line_end - src < 16) {
y = y_temp;
u = u_temp;
v = v_temp;
}
if (line_end - src < 4)
break;
t = AV_RL32(src);
src += 4;
*u++ = t << 6 & 0xFFC0;
*y++ = t >> 4 & 0xFFC0;
*v++ = t >> 14 & 0xFFC0;
if (src >= line_end - 1) {
*y = 0x80;
src++;
line_end += stride;
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
if (line_end - src < 4)
break;
}
t = AV_RL32(src);
src += 4;
*y++ = t << 6 & 0xFFC0;
*u++ = t >> 4 & 0xFFC0;
*y++ = t >> 14 & 0xFFC0;
if (src >= line_end - 2) {
if (!(width & 1)) {
*y = 0x80;
src += 2;
}
line_end += stride;
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
if (line_end - src < 4)
break;
}
t = AV_RL32(src);
src += 4;
@ -113,15 +113,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
*y++ = t >> 4 & 0xFFC0;
*u++ = t >> 14 & 0xFFC0;
if (src >= line_end - 1) {
*y = 0x80;
src++;
line_end += stride;
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
if (line_end - src < 4)
break;
}
t = AV_RL32(src);
src += 4;
@ -129,18 +122,21 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
*v++ = t >> 4 & 0xFFC0;
*y++ = t >> 14 & 0xFFC0;
if (src >= line_end - 2) {
if (width & 1) {
*y = 0x80;
src += 2;
}
line_end += stride;
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
if (width - x < 6)
break;
}
}
if (x < width) {
y = x + (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
memcpy(y, y_temp, sizeof(*y) * (width - x));
memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
}
line_end += stride;
src = line_end - stride;
}
*got_frame = 1;

View File

@ -210,7 +210,7 @@ OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3_data.o
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \

View File

@ -28,6 +28,7 @@
#include "a64tables.h"
#include "elbg.h"
#include "internal.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
@ -65,7 +66,7 @@ static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
//static const int mc_colors[5]={0x0,0x8,0xa,0xf,0x7};
//static const int mc_colors[5]={0x0,0x9,0x8,0xa,0x3};
static void to_meta_with_crop(AVCodecContext *avctx, AVFrame *p, int *dest)
static void to_meta_with_crop(AVCodecContext *avctx, const AVFrame *p, int *dest)
{
int blockx, blocky, x, y;
int luma = 0;
@ -78,9 +79,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;
}
@ -186,7 +191,6 @@ static void render_charset(AVCodecContext *avctx, uint8_t *charset,
static av_cold int a64multi_close_encoder(AVCodecContext *avctx)
{
A64Context *c = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&c->mc_meta_charset);
av_freep(&c->mc_best_cb);
av_freep(&c->mc_charset);
@ -220,7 +224,7 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx)
a64_palette[mc_colors[a]][2] * 0.11;
}
if (!(c->mc_meta_charset = av_malloc_array(c->mc_lifetime, 32000 * sizeof(int))) ||
if (!(c->mc_meta_charset = av_mallocz_array(c->mc_lifetime, 32000 * sizeof(int))) ||
!(c->mc_best_cb = av_malloc(CHARSET_CHARS * 32 * sizeof(int))) ||
!(c->mc_charmap = av_mallocz_array(c->mc_lifetime, 1000 * sizeof(int))) ||
!(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t))) ||
@ -238,14 +242,6 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx)
AV_WB32(avctx->extradata, c->mc_lifetime);
AV_WB32(avctx->extradata + 16, INTERLACED);
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
a64multi_close_encoder(avctx);
return AVERROR(ENOMEM);
}
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
if (!avctx->codec_tag)
avctx->codec_tag = AV_RL32("a64m");
@ -270,10 +266,9 @@ static void a64_compress_colram(unsigned char *buf, int *charmap, uint8_t *colra
}
static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pict, int *got_packet)
const AVFrame *p, int *got_packet)
{
A64Context *c = avctx->priv_data;
AVFrame *const p = avctx->coded_frame;
int frame;
int x, y;
@ -304,7 +299,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
/* no data, means end encoding asap */
if (!pict) {
if (!p) {
/* all done, end encoding */
if (!c->mc_lifetime) return 0;
/* no more frames in queue, prepare to flush remaining frames */
@ -317,13 +312,10 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} else {
/* fill up mc_meta_charset with data until lifetime exceeds */
if (c->mc_frame_counter < c->mc_lifetime) {
*p = *pict;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter);
c->mc_frame_counter++;
if (c->next_pts == AV_NOPTS_VALUE)
c->next_pts = pict->pts;
c->next_pts = p->pts;
/* lifetime is not reached so wait for next frame first */
return 0;
}
@ -334,8 +326,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
req_size = 0;
/* any frames to encode? */
if (c->mc_lifetime) {
req_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0)
int alloc_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
if ((ret = ff_alloc_packet2(avctx, pkt, alloc_size)) < 0)
return ret;
buf = pkt->data;
@ -351,6 +343,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* advance pointers */
buf += charset_size;
req_size += charset_size;
}
/* write x frames to buf */
@ -387,6 +380,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt->pts = pkt->dts = c->next_pts;
c->next_pts = AV_NOPTS_VALUE;
av_assert0(pkt->size >= req_size);
pkt->size = req_size;
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = !!req_size;

View File

@ -425,7 +425,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
* Save current output configuration if and only if it has been locked.
*/
static void push_output_configuration(AACContext *ac) {
if (ac->oc[1].status == OC_LOCKED) {
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
ac->oc[0] = ac->oc[1];
}
ac->oc[1].status = OC_NONE;
@ -904,7 +904,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
if (len == 15 + 255)
len += get_bits(gb, 16);
if (get_bits_left(gb) < len * 8 + 4) {
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
av_log(avctx, AV_LOG_ERROR, overread_err);
return AVERROR_INVALIDDATA;
}
skip_bits_long(gb, 8 * len);
@ -2780,7 +2780,7 @@ static void spectral_to_sample(AACContext *ac)
apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
che->present = 0;
} else if (che) {
av_log(ac->avctx, AV_LOG_WARNING, "ChannelElement %d.%d missing \n", type, i);
av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i);
}
}
}
@ -3059,6 +3059,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
AV_WL32(side, 2*AV_RL32(side));
}
if (!ac->frame->data[0] && samples) {
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
err = AVERROR_INVALIDDATA;
goto fail;
}
*got_frame_ptr = !!samples;
if (samples) {
ac->frame->nb_samples = samples;

View File

@ -165,7 +165,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);
@ -753,10 +753,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
s->chan_map = aac_chan_configs[s->channels-1];
if (ret = dsp_init(avctx, s))
if ((ret = dsp_init(avctx, s)) < 0)
goto fail;
if (ret = alloc_buffers(avctx, s))
if ((ret = alloc_buffers(avctx, s)) < 0)
goto fail;
avctx->extradata_size = 5;
@ -768,7 +768,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
lengths[1] = ff_aac_num_swb_128[i];
for (i = 0; i < s->chan_map[0]; i++)
grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
if (ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping))
if ((ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths,
s->chan_map[0], grouping)) < 0)
goto fail;
s->psypp = ff_psy_preprocess_init(avctx);
s->coder = &ff_aac_coders[s->options.aac_coder];

View File

@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
if (active_lines > 0.0f)
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
pe += calc_pe_3gpp(band);
band->norm_fac = band->active_lines / band->thr;
if (band->thr > 0.0f)
band->norm_fac = band->active_lines / band->thr;
else
band->norm_fac = 0.0f;
norm_fac += band->norm_fac;
}
}

View File

@ -514,7 +514,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
{
int i, k, sb = 0;
int i, k, last_k = -1, last_msb = -1, sb = 0;
int msb = sbr->k[0];
int usb = sbr->kx[1];
int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
@ -528,6 +528,12 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
do {
int odd = 0;
if (k == last_k && msb == last_msb) {
av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
return AVERROR_INVALIDDATA;
}
last_k = k;
last_msb = msb;
for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
sb = sbr->f_master[i];
odd = (sb + sbr->k[0]) & 1;

View File

@ -78,6 +78,7 @@ av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth,
c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
if (chroma_format_idc <= 1)
c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;

View File

@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
return ret;
/* report that the buffer was completely consumed */
return buf_size;
return avpkt->size;
}
static av_cold int aasc_decode_end(AVCodecContext *avctx)

View File

@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
int band_start, band_end, begin, end1;
int lowcomp, fastleak, slowleak;
if (end <= 0)
return AVERROR_INVALIDDATA;
/* excitation function */
band_start = ff_ac3_bin_to_band_tab[start];
band_end = ff_ac3_bin_to_band_tab[end-1] + 1;

View File

@ -872,7 +872,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
start_subband += start_subband - 7;
end_subband = get_bits(gbc, 3) + 5;
#if USE_FIXED
s->spx_dst_end_freq = end_freq_inv_tab[end_subband];
s->spx_dst_end_freq = end_freq_inv_tab[end_subband-5];
#endif
if (end_subband > 7)
end_subband += end_subband - 7;
@ -939,7 +939,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
nblend = 0;
sblend = 0x800000;
} else if (nratio > 0x7fffff) {
nblend = 0x800000;
nblend = 14529495; // sqrt(3) in FP.23
sblend = 0;
} else {
nblend = fixed_sqrt(nratio, 23);

View File

@ -243,19 +243,19 @@ typedef struct AC3DecodeContext {
* Parse the E-AC-3 frame header.
* This parses both the bit stream info and audio frame header.
*/
int ff_eac3_parse_header(AC3DecodeContext *s);
static int ff_eac3_parse_header(AC3DecodeContext *s);
/**
* Decode mantissas in a single channel for the entire frame.
* This is used when AHT mode is enabled.
*/
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
/**
* Apply spectral extension to each channel by copying lower frequency
* coefficients to higher frequency bins and applying side information to
* approximate the original high frequency signal.
*/
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
#endif /* AVCODEC_AC3DEC_H */

View File

@ -164,6 +164,7 @@ static void ac3_downmix_c_fixed16(int16_t **samples, int16_t (*matrix)[2],
}
}
#include "eac3dec.c"
#include "ac3dec.c"
static const AVOption options[] = {

View File

@ -28,6 +28,7 @@
* Upmix delay samples from stereo to original channel layout.
*/
#include "ac3dec.h"
#include "eac3dec.c"
#include "ac3dec.c"
static const AVOption options[] = {

View File

@ -541,7 +541,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
case AV_CODEC_ID_ADPCM_IMA_QT:
{
PutBitContext pb;
init_put_bits(&pb, dst, pkt_size * 8);
init_put_bits(&pb, dst, pkt_size);
for (ch = 0; ch < avctx->channels; ch++) {
ADPCMChannelStatus *status = &c->status[ch];
@ -571,7 +571,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
case AV_CODEC_ID_ADPCM_SWF:
{
PutBitContext pb;
init_put_bits(&pb, dst, pkt_size * 8);
init_put_bits(&pb, dst, pkt_size);
n = frame->nb_samples - 1;

View File

@ -438,8 +438,8 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
ctx->mb_width = FFALIGN(avctx->width, 16) >> 4;
ctx->mb_height = FFALIGN(avctx->height, 16) >> 4;
ctx->num_x_slices = 16;
ctx->slice_width = ctx->mb_width / 16;
ctx->num_x_slices = (ctx->mb_width + 15) >> 4;
ctx->slice_width = 16;
for (i = 1; i < 32; i++) {
if (!(ctx->mb_width % i) && (ctx->mb_width / i < 32)) {
ctx->slice_width = ctx->mb_width / i;

View File

@ -316,6 +316,11 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
int lpc_quant[2];
int rice_history_mult[2];
if (!alac->rice_limit) {
avpriv_request_sample(alac->avctx, "Compression with rice limit 0");
return AVERROR(ENOSYS);
}
decorr_shift = get_bits(&alac->gb, 8);
decorr_left_weight = get_bits(&alac->gb, 8);

View File

@ -357,11 +357,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
ctx->cs_switch = 1;
for (i = 0; i < avctx->channels; i++) {
sconf->chan_pos[i] = -1;
}
for (i = 0; i < avctx->channels; i++) {
int idx;
idx = get_bits(&gb, chan_pos_bits);
if (idx >= avctx->channels) {
if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
ctx->cs_switch = 0;
break;
@ -678,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
if (!sconf->rlslms) {
if (sconf->adapt_order) {
if (sconf->adapt_order && sconf->max_order) {
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);
@ -1242,6 +1246,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
ALSChannelData *ch = cd[c];
unsigned int dep = 0;
unsigned int channels = ctx->avctx->channels;
unsigned int channel_size = ctx->sconf.frame_length + ctx->sconf.max_order;
if (reverted[c])
return 0;
@ -1272,9 +1277,9 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
bd->raw_samples = ctx->raw_samples[c] + offset;
for (dep = 0; !ch[dep].stop_flag; dep++) {
unsigned int smp;
unsigned int begin = 1;
unsigned int end = bd->block_length - 1;
ptrdiff_t smp;
ptrdiff_t begin = 1;
ptrdiff_t end = bd->block_length - 1;
int64_t y;
int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
@ -1286,11 +1291,28 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
if (ch[dep].time_diff_sign) {
t = -t;
if (begin < t) {
av_log(ctx->avctx, AV_LOG_ERROR, "begin %td smaller than time diff index %d.\n", begin, t);
return AVERROR_INVALIDDATA;
}
begin -= t;
} else {
if (end < t) {
av_log(ctx->avctx, AV_LOG_ERROR, "end %td smaller than time diff index %d.\n", end, t);
return AVERROR_INVALIDDATA;
}
end -= t;
}
if (FFMIN(begin - 1, begin - 1 + t) < ctx->raw_buffer - master ||
FFMAX(end + 1, end + 1 + t) > ctx->raw_buffer + channels * channel_size - master) {
av_log(ctx->avctx, AV_LOG_ERROR,
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
master + FFMIN(begin - 1, begin - 1 + t), master + FFMAX(end + 1, end + 1 + t),
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
return AVERROR_INVALIDDATA;
}
for (smp = begin; smp < end; smp++) {
y = (1 << 6) +
MUL64(ch[dep].weighting[0], master[smp - 1 ]) +
@ -1303,6 +1325,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
bd->raw_samples[smp] += y >> 7;
}
} else {
if (begin - 1 < ctx->raw_buffer - master ||
end + 1 > ctx->raw_buffer + channels * channel_size - master) {
av_log(ctx->avctx, AV_LOG_ERROR,
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
master + begin - 1, master + end + 1,
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
return AVERROR_INVALIDDATA;
}
for (smp = begin; smp < end; smp++) {
y = (1 << 6) +
MUL64(ch[dep].weighting[0], master[smp - 1]) +
@ -1727,9 +1759,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
// allocate and assign channel data buffer for mcc mode
if (sconf->mc_coding) {
ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) *
ctx->chan_data_buffer = av_mallocz(sizeof(*ctx->chan_data_buffer) *
num_buffers * num_buffers);
ctx->chan_data = av_malloc(sizeof(*ctx->chan_data) *
ctx->chan_data = av_mallocz(sizeof(*ctx->chan_data) *
num_buffers);
ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
num_buffers);

View File

@ -601,14 +601,14 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
int ksummax, ksummin;
rice->ksum = 0;
for (i = 0; i < 5; i++) {
for (i = 0; i < FFMIN(blockstodecode, 5); i++) {
out[i] = get_rice_ook(&ctx->gb, 10);
rice->ksum += out[i];
}
rice->k = av_log2(rice->ksum / 10) + 1;
if (rice->k >= 24)
return;
for (; i < 64; i++) {
for (; i < FFMIN(blockstodecode, 64); i++) {
out[i] = get_rice_ook(&ctx->gb, rice->k);
rice->ksum += out[i];
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
@ -1476,13 +1476,13 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
nblocks);
return AVERROR_INVALIDDATA;
}
s->samples = nblocks;
/* Initialize the frame decoder */
if (init_frame_decoder(s) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
return AVERROR_INVALIDDATA;
}
s->samples = nblocks;
}
if (!s->data) {

View File

@ -23,9 +23,10 @@
#include "libavutil/arm/asm.S"
function ff_prefetch_arm, export=1
1:
subs r2, r2, #1
pld [r0]
add r0, r0, r1
bne X(ff_prefetch_arm)
bne 1b
bx lr
endfunc

View File

@ -599,8 +599,8 @@ void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist,
const float *in, float *out)
{
int i, s, sb, t, pos_now, pos_next;
DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS];
DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS];
LOCAL_ALIGNED(32, float, idct_in, [ATRAC3P_SUBBANDS]);
LOCAL_ALIGNED(32, float, idct_out, [ATRAC3P_SUBBANDS]);
memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));

View File

@ -563,6 +563,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
return AVERROR_INVALIDDATA;
}
esc_code = get_ue_code(gb, esc_golomb_order);
if (esc_code < 0 || esc_code > 32767) {
av_log(h->avctx, AV_LOG_ERROR, "esc_code invalid\n");
return AVERROR_INVALIDDATA;
}
level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
while (level > r->inc_limit)
r++;
@ -1118,6 +1123,7 @@ static int decode_seq_header(AVSContext *h)
{
int frame_rate_code;
int width, height;
int ret;
h->profile = get_bits(&h->gb, 8);
h->level = get_bits(&h->gb, 8);
@ -1134,9 +1140,6 @@ static int decode_seq_header(AVSContext *h)
av_log(h->avctx, AV_LOG_ERROR, "Dimensions invalid\n");
return AVERROR_INVALIDDATA;
}
h->width = width;
h->height = height;
skip_bits(&h->gb, 2); //chroma format
skip_bits(&h->gb, 3); //sample_precision
h->aspect_ratio = get_bits(&h->gb, 4);
@ -1145,11 +1148,16 @@ static int decode_seq_header(AVSContext *h)
skip_bits1(&h->gb); //marker_bit
skip_bits(&h->gb, 12); //bit_rate_upper
h->low_delay = get_bits1(&h->gb);
ret = ff_set_dimensions(h->avctx, width, height);
if (ret < 0)
return ret;
h->width = width;
h->height = height;
h->mb_width = (h->width + 15) >> 4;
h->mb_height = (h->height + 15) >> 4;
h->avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code];
h->avctx->width = h->width;
h->avctx->height = h->height;
if (!h->top_qp)
ff_cavs_init_top_lines(h);
return 0;

View File

@ -584,6 +584,14 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
}
nchans = get_bits(&s->gb, 3) + 1;
if (xxch && nchans >= 3) {
av_log(s->avctx, AV_LOG_ERROR, "nchans %d is too large\n", nchans);
return AVERROR_INVALIDDATA;
} else if (nchans + base_channel > DCA_PRIM_CHANNELS_MAX) {
av_log(s->avctx, AV_LOG_ERROR, "channel sum %d + %d is too large\n", nchans, base_channel);
return AVERROR_INVALIDDATA;
}
s->total_channels = nchans + base_channel;
s->prim_channels = s->total_channels;
@ -848,6 +856,10 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
if (!base_channel) {
s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
if (block_index + s->subsubframes[s->current_subframe] > s->sample_blocks/8) {
s->subsubframes[s->current_subframe] = 1;
return AVERROR_INVALIDDATA;
}
s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
}
@ -1811,8 +1823,13 @@ static int dca_xbr_parse_frame(DCAContext *s)
for(i = 0; i < num_chsets; i++) {
n_xbr_ch[i] = get_bits(&s->gb, 3) + 1;
k = get_bits(&s->gb, 2) + 5;
for(j = 0; j < n_xbr_ch[i]; j++)
for(j = 0; j < n_xbr_ch[i]; j++) {
active_bands[i][j] = get_bits(&s->gb, k) + 1;
if (active_bands[i][j] > DCA_SUBBANDS) {
av_log(s->avctx, AV_LOG_ERROR, "too many active subbands (%d)\n", active_bands[i][j]);
return AVERROR_INVALIDDATA;
}
}
}
/* skip to the end of the header */
@ -1854,23 +1871,34 @@ static int dca_xbr_parse_frame(DCAContext *s)
for(i = 0; i < n_xbr_ch[chset]; i++) {
const uint32_t *scale_table;
int nbits;
int scale_table_size;
if (s->scalefactor_huffman[chan_base+i] == 6) {
scale_table = scale_factor_quant7;
scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant7);
} else {
scale_table = scale_factor_quant6;
scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant6);
}
nbits = anctemp[i];
for(j = 0; j < active_bands[chset][i]; j++) {
if(abits_high[i][j] > 0) {
scale_table_high[i][j][0] =
scale_table[get_bits(&s->gb, nbits)];
int index = get_bits(&s->gb, nbits);
if (index >= scale_table_size) {
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
return AVERROR_INVALIDDATA;
}
scale_table_high[i][j][0] = scale_table[index];
if(xbr_tmode && s->transition_mode[i][j]) {
scale_table_high[i][j][1] =
scale_table[get_bits(&s->gb, nbits)];
int index = get_bits(&s->gb, nbits);
if (index >= scale_table_size) {
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
return AVERROR_INVALIDDATA;
}
scale_table_high[i][j][1] = scale_table[index];
}
}
}
@ -2360,6 +2388,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
#else
if (s->xch_present && !s->xch_disable) {
#endif
if (avctx->channel_layout & AV_CH_BACK_CENTER) {
avpriv_request_sample(avctx, "XCh with Back center channel");
return AVERROR_INVALIDDATA;
}
avctx->channel_layout |= AV_CH_BACK_CENTER;
if (s->lfe) {
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;

View File

@ -799,7 +799,10 @@ static void decode_lowdelay(DiracContext *s)
slice_num++;
buf += bytes;
bufsize -= bytes*8;
if (bufsize/8 >= bytes)
bufsize -= bytes*8;
else
bufsize = 0;
}
avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
@ -896,6 +899,14 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
/*[DIRAC_STD] 11.2.4 motion_data_dimensions()
Calculated in function dirac_unpack_block_motion_data */
if (s->plane[0].xblen % (1 << s->chroma_x_shift) != 0 ||
s->plane[0].yblen % (1 << s->chroma_y_shift) != 0 ||
!s->plane[0].xblen || !s->plane[0].yblen) {
av_log(s->avctx, AV_LOG_ERROR,
"invalid x/y block length (%d/%d) for x/y chroma shift (%d/%d)\n",
s->plane[0].xblen, s->plane[0].yblen, s->chroma_x_shift, s->chroma_y_shift);
return AVERROR_INVALIDDATA;
}
if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
return -1;
@ -1736,6 +1747,12 @@ static int dirac_decode_picture_header(DiracContext *s)
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
break;
}
if (!s->ref_pics[i]) {
av_log(s->avctx, AV_LOG_ERROR, "Reference could not be allocated\n");
return -1;
}
}
/* retire the reference frames that are not used anymore */
@ -1931,8 +1948,8 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break;
data_unit_size = AV_RB32(buf+buf_idx+5);
if (buf_idx + data_unit_size > buf_size || !data_unit_size) {
if(buf_idx + data_unit_size > buf_size)
if (data_unit_size > buf_size - buf_idx || !data_unit_size) {
if(data_unit_size > buf_size - buf_idx)
av_log(s->avctx, AV_LOG_ERROR,
"Data unit with size %d is larger than input buffer, discarding\n",
data_unit_size);

View File

@ -363,7 +363,7 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame,
dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
if (ctx->cur_field) {
if (frame->interlaced_frame && ctx->cur_field) {
dest_y += frame->linesize[0];
dest_u += frame->linesize[1];
dest_v += frame->linesize[2];

View File

@ -39,7 +39,7 @@ typedef struct DVDSubContext
int has_palette;
uint8_t colormap[4];
uint8_t alpha[256];
uint8_t *buf;
uint8_t buf[0x10000];
int buf_size;
int forced_subs_only;
#ifdef DEBUG
@ -108,6 +108,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);
@ -359,10 +365,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)
@ -501,15 +509,11 @@ static int append_to_cached_buf(AVCodecContext *avctx,
{
DVDSubContext *ctx = avctx->priv_data;
if (ctx->buf_size > 0xffff - buf_size) {
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
"too large SPU packets aborted.\n");
av_freep(&ctx->buf);
return AVERROR_INVALIDDATA;
}
ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size);
if (!ctx->buf)
return AVERROR(ENOMEM);
memcpy(ctx->buf + ctx->buf_size, buf, buf_size);
ctx->buf_size += buf_size;
return 0;
@ -525,7 +529,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
AVSubtitle *sub = data;
int is_menu;
if (ctx->buf) {
if (ctx->buf_size) {
int ret = append_to_cached_buf(avctx, buf, buf_size);
if (ret < 0) {
*data_size = 0;
@ -567,7 +571,6 @@ static int dvdsub_decode(AVCodecContext *avctx,
}
#endif
av_freep(&ctx->buf);
ctx->buf_size = 0;
*data_size = 1;
return buf_size;
@ -711,7 +714,6 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
static av_cold int dvdsub_close(AVCodecContext *avctx)
{
DVDSubContext *ctx = avctx->priv_data;
av_freep(&ctx->buf);
ctx->buf_size = 0;
return 0;
}

View File

@ -65,7 +65,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
int ret;
if (src_size < avctx->width * avctx->height * 9L / 8) {
if (src_size < avctx->width * avctx->height * 9LL / 8) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA;
}
@ -108,7 +108,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y1, *Y2, *U, *V;
int ret;
if (src_size < avctx->width * avctx->height * 3L / 2) {
if (src_size < avctx->width * avctx->height * 3LL / 2) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA;
}
@ -145,7 +145,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
uint8_t *Y, *U, *V;
int ret;
if (src_size < avctx->width * avctx->height * 3L) {
if (src_size < avctx->width * avctx->height * 3LL) {
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
return AVERROR_INVALIDDATA;
}

View File

@ -63,7 +63,7 @@ typedef enum {
#define EAC3_SR_CODE_REDUCED 3
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
{
int bin, bnd, ch, i;
uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
@ -101,7 +101,7 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
for (i = 0; i < num_copy_sections; i++) {
memcpy(&s->transform_coeffs[ch][bin],
&s->transform_coeffs[ch][s->spx_dst_start_freq],
copy_sizes[i]*sizeof(float));
copy_sizes[i]*sizeof(INTFLOAT));
bin += copy_sizes[i];
}
@ -124,7 +124,7 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
bin = s->spx_src_start_freq - 2;
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
if (wrapflag[bnd]) {
float *coeffs = &s->transform_coeffs[ch][bin];
INTFLOAT *coeffs = &s->transform_coeffs[ch][bin];
coeffs[0] *= atten_tab[0];
coeffs[1] *= atten_tab[1];
coeffs[2] *= atten_tab[2];
@ -142,6 +142,11 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN);
float sscale = s->spx_signal_blend[ch][bnd];
#if USE_FIXED
// spx_noise_blend and spx_signal_blend are both FP.23
nscale *= 1.0 / (1<<23);
sscale *= 1.0 / (1<<23);
#endif
for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
s->transform_coeffs[ch][bin] *= sscale;
@ -195,7 +200,7 @@ static void idct6(int pre_mant[6])
pre_mant[5] = even0 - odd0;
}
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
{
int bin, blk, gs;
int end_bap, gaq_mode;
@ -288,7 +293,7 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
}
}
int ff_eac3_parse_header(AC3DecodeContext *s)
static int ff_eac3_parse_header(AC3DecodeContext *s)
{
int i, blk, ch;
int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data;

View File

@ -151,6 +151,11 @@ static inline int decode_block_intra(MadContext *s, int16_t * 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;
@ -165,6 +170,11 @@ static inline int decode_block_intra(MadContext *s, int16_t * 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;
@ -176,10 +186,6 @@ static inline int decode_block_intra(MadContext *s, int16_t * 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;
}

View File

@ -251,7 +251,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

@ -546,6 +546,12 @@ static int read_extra_header(FFV1Context *f)
f->num_h_slices = 1 + get_symbol(c, state, 0);
f->num_v_slices = 1 + get_symbol(c, state, 0);
if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
f->chroma_h_shift, f->chroma_v_shift);
return AVERROR_INVALIDDATA;
}
if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
f->num_v_slices > (unsigned)f->height || !f->num_v_slices
) {
@ -651,6 +657,12 @@ static int read_header(FFV1Context *f)
}
}
if (chroma_h_shift > 4U || chroma_v_shift > 4U) {
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
chroma_h_shift, chroma_v_shift);
return AVERROR_INVALIDDATA;
}
f->colorspace = colorspace;
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
f->chroma_planes = chroma_planes;

View File

@ -697,7 +697,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
handle_error:
*poutbuf = NULL;
*poutbuf_size = 0;
return read_end - buf;
return buf_size ? read_end - buf : 0;
}
static av_cold int flac_parse_init(AVCodecParserContext *c)

View File

@ -287,7 +287,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size)
if (buf_size < 5)
return -1;
init_put_bits(&pb, buf, buf_size * 8);
init_put_bits(&pb, buf, buf_size);
put_bits(&pb, 4, (s->block_width >> 4) - 1);
put_bits(&pb, 12, s->image_width);

View File

@ -151,7 +151,7 @@ static int encode_bitstream(FlashSVContext *s, const AVFrame *p, uint8_t *buf,
int buf_pos, res;
int pred_blocks = 0;
init_put_bits(&pb, buf, buf_size * 8);
init_put_bits(&pb, buf, buf_size);
put_bits(&pb, 4, block_width / 16 - 1);
put_bits(&pb, 12, s->image_width);

View File

@ -105,7 +105,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
/* skip common columns */
while (x_start < x_end) {
int same_column = 1;
for (y = y_start; y < y_end; y++) {
for (y = y_start; y <= y_end; y++) {
if (ref[y*ref_linesize + x_start] != buf[y*linesize + x_start]) {
same_column = 0;
break;
@ -117,7 +117,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
}
while (x_end > x_start) {
int same_column = 1;
for (y = y_start; y < y_end; y++) {
for (y = y_start; y <= y_end; y++) {
if (ref[y*ref_linesize + x_end] != buf[y*linesize + x_end]) {
same_column = 0;
break;

View File

@ -346,8 +346,16 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
if (i < limit - 1) {
if (k) {
buf = SHOW_UBITS(re, gb, k);
LAST_SKIP_BITS(re, gb, k);
if (k > MIN_CACHE_BITS - 1) {
buf = SHOW_UBITS(re, gb, 16) << (k-16);
LAST_SKIP_BITS(re, gb, 16);
UPDATE_CACHE(re, gb);
buf |= SHOW_UBITS(re, gb, k-16);
LAST_SKIP_BITS(re, gb, k-16);
} else {
buf = SHOW_UBITS(re, gb, k);
LAST_SKIP_BITS(re, gb, k);
}
} else {
buf = 0;
}

View File

@ -391,6 +391,7 @@ void ff_h264_free_tables(H264Context *h, int free_rbsp)
if (free_rbsp && h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
ff_h264_unref_picture(h, &h->DPB[i]);
memset(h->delayed_pic, 0, sizeof(h->delayed_pic));
av_freep(&h->DPB);
} else if (h->DPB) {
for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)
@ -726,6 +727,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
h->avctx = avctx;
h->rbsp_buffer[0] = NULL;
h->rbsp_buffer[1] = NULL;
h->rbsp_buffer_size[0] = 0;
@ -990,6 +992,16 @@ int ff_pred_weight_table(H264Context *h)
h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->sps.chroma_format_idc)
h->chroma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->luma_log2_weight_denom > 7U) {
av_log(h->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", h->luma_log2_weight_denom);
h->luma_log2_weight_denom = 0;
}
if (h->chroma_log2_weight_denom > 7U) {
av_log(h->avctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", h->chroma_log2_weight_denom);
h->chroma_log2_weight_denom = 0;
}
luma_def = 1 << h->luma_log2_weight_denom;
chroma_def = 1 << h->chroma_log2_weight_denom;
@ -1504,9 +1516,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
continue;
again:
if ( !(avctx->active_thread_type & FF_THREAD_FRAME)
|| nals_needed >= nal_index)
h->au_pps_id = -1;
/* Ignore per frame NAL unit type during extradata
* parsing. Decoding slices is not possible in codec init
* with frame-mt */
@ -1542,8 +1551,14 @@ again:
ret = -1;
goto end;
}
if(!idr_cleared)
if(!idr_cleared) {
if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {
av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
ret = AVERROR_INVALIDDATA;
goto end;
}
idr(h); // FIXME ensure we don't lose some frames if there is reordering
}
idr_cleared = 1;
h->has_recovery_point = 1;
case NAL_SLICE:
@ -1552,6 +1567,10 @@ again:
hx->inter_gb_ptr = &hx->gb;
hx->data_partitioning = 0;
if ( nals_needed >= nal_index
|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count))
h->au_pps_id = -1;
if ((err = ff_h264_decode_slice_header(hx, h)))
break;
@ -1673,7 +1692,9 @@ again:
break;
case NAL_SPS:
init_get_bits(&h->gb, ptr, bit_length);
if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? nalsize : 1)) {
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
break;
if (h->is_avc ? nalsize : 1) {
av_log(h->avctx, AV_LOG_DEBUG,
"SPS decoding failure, trying again with the complete NAL\n");
if (h->is_avc)
@ -1682,8 +1703,11 @@ again:
break;
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
8*(next_avc - buf_index + consumed - 1));
ff_h264_decode_seq_parameter_set(h);
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
break;
}
init_get_bits(&h->gb, ptr, bit_length);
ff_h264_decode_seq_parameter_set(h, 1);
break;
case NAL_PPS:
@ -1716,8 +1740,14 @@ again:
if (err < 0 || err == SLICE_SKIPED) {
if (err < 0)
av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
hx->ref_count[0] = hx->ref_count[1] = hx->list_count = 0;
} else if (err == SLICE_SINGLETHREAD) {
if (context_count > 1) {
ret = ff_h264_execute_decode_slices(h, context_count - 1);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
goto end;
context_count = 0;
}
/* Slice could not be decoded in parallel mode, copy down
* NAL unit stuff to context 0 and restart. Note that
* rbsp_buffer is not transferred, but since we no longer

View File

@ -338,6 +338,7 @@ typedef struct H264Picture {
* H264Context
*/
typedef struct H264Context {
AVClass *av_class;
AVCodecContext *avctx;
MECmpContext mecc;
VideoDSPContext vdsp;
@ -538,6 +539,7 @@ typedef struct H264Context {
int mb_x, mb_y;
int resync_mb_x;
int resync_mb_y;
int mb_index_end;
int mb_skip_run;
int mb_height, mb_width;
int mb_stride;
@ -777,7 +779,7 @@ int ff_h264_decode_sei(H264Context *h);
/**
* Decode SPS
*/
int ff_h264_decode_seq_parameter_set(H264Context *h);
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation);
/**
* compute profile from sps

View File

@ -1282,7 +1282,7 @@ void ff_h264_init_cabac_states(H264Context *h) {
}
static int decode_cabac_field_decoding_flag(H264Context *h) {
const long mbb_xy = h->mb_xy - 2L*h->mb_stride;
const int mbb_xy = h->mb_xy - 2*h->mb_stride;
unsigned long ctx = 0;

View File

@ -271,7 +271,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
init_get_bits(&h->gb, ptr, 8 * dst_length);
switch (h->nal_unit_type) {
case NAL_SPS:
ff_h264_decode_seq_parameter_set(h);
ff_h264_decode_seq_parameter_set(h, 0);
break;
case NAL_PPS:
ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);

View File

@ -241,12 +241,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
}
}
if (get_bits_left(&h->gb) < 0) {
av_log(h->avctx, AV_LOG_ERROR,
"Overread VUI by %d bits\n", -get_bits_left(&h->gb));
return AVERROR_INVALIDDATA;
}
return 0;
}
@ -303,7 +297,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps,
}
}
int ff_h264_decode_seq_parameter_set(H264Context *h)
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
{
int profile_idc, level_idc, constraint_set_flags = 0;
unsigned int sps_id;
@ -371,7 +365,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
"Different chroma and luma bit depth");
goto fail;
}
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) {
if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||
sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) {
av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
sps->bit_depth_luma, sps->bit_depth_chroma);
goto fail;
@ -522,6 +517,13 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
goto fail;
}
if (get_bits_left(&h->gb) < 0) {
av_log(h->avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR,
"Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
if (!ignore_truncation)
goto fail;
}
if (!sps->sar.den)
sps->sar.den = 1;

View File

@ -707,7 +707,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
*/
if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
/* Just mark the second field valid */
h->cur_pic_ptr->reference = PICT_FRAME;
h->cur_pic_ptr->reference |= h->picture_structure;
} else if (h->cur_pic_ptr->long_ref) {
av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
"assignment for second field "

View File

@ -1305,6 +1305,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
int must_reinit;
int needs_reinit = 0;
int field_pic_flag, bottom_field_flag;
int first_slice = h == h0 && !h0->current_slice;
int frame_num, picture_structure, droppable;
int mb_aff_frame, last_mb_aff_frame;
PPS *pps;
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab;
@ -1378,18 +1382,27 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
h0->au_pps_id, pps_id);
return AVERROR_INVALIDDATA;
}
h->pps = *h0->pps_buffers[pps_id];
if (!h0->sps_buffers[h->pps.sps_id]) {
pps = h0->pps_buffers[pps_id];
if (!h0->sps_buffers[pps->sps_id]) {
av_log(h->avctx, AV_LOG_ERROR,
"non-existing SPS %u referenced\n",
h->pps.sps_id);
return AVERROR_INVALIDDATA;
}
if (first_slice)
h->pps = *h0->pps_buffers[pps_id];
if (h->pps.sps_id != h->sps.sps_id ||
h->pps.sps_id != h->current_sps_id ||
h0->sps_buffers[h->pps.sps_id]->new) {
if (pps->sps_id != h->sps.sps_id ||
pps->sps_id != h->current_sps_id ||
h0->sps_buffers[pps->sps_id]->new) {
if (!first_slice) {
av_log(h->avctx, AV_LOG_ERROR,
"SPS changed in the middle of the frame\n");
return AVERROR_INVALIDDATA;
}
h->sps = *h0->sps_buffers[h->pps.sps_id];
@ -1419,11 +1432,14 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
|| h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)
|| h->mb_width != h->sps.mb_width
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
));
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
if (h0->avctx->pix_fmt == AV_PIX_FMT_NONE
|| (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))))
must_reinit = 1;
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
must_reinit = 1;
h->mb_width = h->sps.mb_width;
@ -1466,6 +1482,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
return AVERROR_INVALIDDATA;
}
av_assert1(first_slice);
ff_h264_flush_change(h);
if ((ret = get_pixel_format(h, 1)) < 0)
@ -1499,44 +1517,50 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
}
}
if (h == h0 && h->dequant_coeff_pps != pps_id) {
if (first_slice && h->dequant_coeff_pps != pps_id) {
h->dequant_coeff_pps = pps_id;
h264_init_dequant_tables(h);
}
h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
if (!first_slice) {
if (h0->frame_num != frame_num) {
av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
h0->frame_num, frame_num);
return AVERROR_INVALIDDATA;
}
}
h->mb_mbaff = 0;
h->mb_aff_frame = 0;
mb_aff_frame = 0;
last_mb_aff_frame = h0->mb_aff_frame;
last_pic_structure = h0->picture_structure;
last_pic_droppable = h0->droppable;
h->droppable = h->nal_ref_idc == 0;
droppable = h->nal_ref_idc == 0;
if (h->sps.frame_mbs_only_flag) {
h->picture_structure = PICT_FRAME;
picture_structure = PICT_FRAME;
} else {
if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) {
av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
return -1;
}
field_pic_flag = get_bits1(&h->gb);
if (field_pic_flag) {
bottom_field_flag = get_bits1(&h->gb);
h->picture_structure = PICT_TOP_FIELD + bottom_field_flag;
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
} else {
h->picture_structure = PICT_FRAME;
h->mb_aff_frame = h->sps.mb_aff;
picture_structure = PICT_FRAME;
mb_aff_frame = h->sps.mb_aff;
}
}
h->mb_field_decoding_flag = h->picture_structure != PICT_FRAME;
if (h0->current_slice != 0) {
if (last_pic_structure != h->picture_structure ||
last_pic_droppable != h->droppable) {
if (h0->current_slice) {
if (last_pic_structure != picture_structure ||
last_pic_droppable != droppable ||
last_mb_aff_frame != mb_aff_frame) {
av_log(h->avctx, AV_LOG_ERROR,
"Changing field mode (%d -> %d) between slices is not allowed\n",
last_pic_structure, h->picture_structure);
h->picture_structure = last_pic_structure;
h->droppable = last_pic_droppable;
return AVERROR_INVALIDDATA;
} else if (!h0->cur_pic_ptr) {
av_log(h->avctx, AV_LOG_ERROR,
@ -1544,7 +1568,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
h0->current_slice + 1);
return AVERROR_INVALIDDATA;
}
} else {
}
h->picture_structure = picture_structure;
h->droppable = droppable;
h->frame_num = frame_num;
h->mb_aff_frame = mb_aff_frame;
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
if (h0->current_slice == 0) {
/* Shorten frame num gaps so we don't have to allocate reference
* frames just to throw them away */
if (h->frame_num != h->prev_frame_num) {
@ -2417,8 +2449,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
for (;;) {
// START_TIMER
int ret = ff_h264_decode_mb_cabac(h);
int eos;
int ret, eos;
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
h->mb_index_end);
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
h->mb_y, ER_MB_ERROR);
return AVERROR_INVALIDDATA;
}
ret = ff_h264_decode_mb_cabac(h);
// STOP_TIMER("decode_mb_cabac")
if (ret >= 0)
@ -2480,7 +2521,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
}
} else {
for (;;) {
int ret = ff_h264_decode_mb_cavlc(h);
int ret;
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
h->mb_index_end);
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
h->mb_y, ER_MB_ERROR);
return AVERROR_INVALIDDATA;
}
ret = ff_h264_decode_mb_cavlc(h);
if (ret >= 0)
ff_h264_hl_decode_mb(h);
@ -2568,19 +2619,33 @@ int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
av_assert0(h->mb_y < h->mb_height);
h->mb_index_end = INT_MAX;
if (h->avctx->hwaccel ||
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
return 0;
if (context_count == 1) {
return decode_slice(avctx, &h);
} else {
int j, mb_index;
av_assert0(context_count > 0);
for (i = 1; i < context_count; i++) {
for (i = 0; i < context_count; i++) {
int mb_index_end = h->mb_width * h->mb_height;
hx = h->thread_context[i];
if (CONFIG_ERROR_RESILIENCE) {
mb_index = hx->resync_mb_x + hx->resync_mb_y * h->mb_width;
if (CONFIG_ERROR_RESILIENCE && i) {
hx->er.error_count = 0;
}
hx->x264_build = h->x264_build;
for (j = 0; j < context_count; j++) {
H264Context *sl2 = h->thread_context[j];
int mb_index2 = sl2->resync_mb_x + sl2->resync_mb_y * h->mb_width;
if (i==j || mb_index > mb_index2)
continue;
mb_index_end = FFMIN(mb_index_end, mb_index2);
}
hx->mb_index_end = mb_index_end;
}
avctx->execute(avctx, decode_slice, h->thread_context,

View File

@ -108,7 +108,7 @@ static int pic_arrays_init(HEVCContext *s, const HEVCSPS *sps)
if (!s->tab_ipm || !s->cbf_luma || !s->is_pcm)
goto fail;
s->filter_slice_edges = av_malloc(ctb_count);
s->filter_slice_edges = av_mallocz(ctb_count);
s->tab_slice_address = av_malloc_array(pic_size_in_ctb,
sizeof(*s->tab_slice_address));
s->qp_y_tab = av_malloc_array(pic_size_in_ctb,
@ -144,7 +144,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
uint8_t luma_weight_l1_flag[16];
uint8_t chroma_weight_l1_flag[16];
s->sh.luma_log2_weight_denom = get_ue_golomb_long(gb);
s->sh.luma_log2_weight_denom = av_clip_c(get_ue_golomb_long(gb), 0, 7);
if (s->sps->chroma_format_idc != 0) {
int delta = get_se_golomb(gb);
s->sh.chroma_log2_weight_denom = av_clip(s->sh.luma_log2_weight_denom + delta, 0, 7);
@ -674,11 +674,25 @@ static int hls_slice_header(HEVCContext *s)
sh->num_entry_point_offsets = 0;
if (s->pps->tiles_enabled_flag || s->pps->entropy_coding_sync_enabled_flag) {
sh->num_entry_point_offsets = get_ue_golomb_long(gb);
unsigned num_entry_point_offsets = get_ue_golomb_long(gb);
// It would be possible to bound this tighter but this here is simpler
if (num_entry_point_offsets > get_bits_left(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
return AVERROR_INVALIDDATA;
}
sh->num_entry_point_offsets = num_entry_point_offsets;
if (sh->num_entry_point_offsets > 0) {
int offset_len = get_ue_golomb_long(gb) + 1;
int segments = offset_len >> 4;
int rest = (offset_len & 15);
if (offset_len < 1 || offset_len > 32) {
sh->num_entry_point_offsets = 0;
av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len);
return AVERROR_INVALIDDATA;
}
av_freep(&sh->entry_point_offset);
av_freep(&sh->offset);
av_freep(&sh->size);
@ -2870,17 +2884,30 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
if (s->nals_allocated < s->nb_nals + 1) {
int new_size = s->nals_allocated + 1;
HEVCNAL *tmp = av_realloc_array(s->nals, new_size, sizeof(*tmp));
void *tmp = av_realloc_array(s->nals, new_size, sizeof(*s->nals));
ret = AVERROR(ENOMEM);
if (!tmp) {
ret = AVERROR(ENOMEM);
goto fail;
}
s->nals = tmp;
memset(s->nals + s->nals_allocated, 0,
(new_size - s->nals_allocated) * sizeof(*tmp));
av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
(new_size - s->nals_allocated) * sizeof(*s->nals));
tmp = av_realloc_array(s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
if (!tmp)
goto fail;
s->skipped_bytes_nal = tmp;
tmp = av_realloc_array(s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
if (!tmp)
goto fail;
s->skipped_bytes_pos_size_nal = tmp;
tmp = av_realloc_array(s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
if (!tmp)
goto fail;
s->skipped_bytes_pos_nal = tmp;
s->skipped_bytes_pos_size_nal[s->nals_allocated] = 1024; // initial buffer size
s->skipped_bytes_pos_nal[s->nals_allocated] = av_malloc_array(s->skipped_bytes_pos_size_nal[s->nals_allocated], sizeof(*s->skipped_bytes_pos));
s->nals_allocated = new_size;
@ -2916,7 +2943,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
/* parse the NAL units */
for (i = 0; i < s->nb_nals; i++) {
int ret;
s->skipped_bytes = s->skipped_bytes_nal[i];
s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];

View File

@ -298,10 +298,10 @@ typedef struct RefPicListTab {
} RefPicListTab;
typedef struct HEVCWindow {
int left_offset;
int right_offset;
int top_offset;
int bottom_offset;
unsigned int left_offset;
unsigned int right_offset;
unsigned int top_offset;
unsigned int bottom_offset;
} HEVCWindow;
typedef struct VUI {

View File

@ -424,7 +424,8 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
vps->vps_max_layer_id = get_bits(gb, 6);
vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
if ((vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 ||
(vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
goto err;
}
@ -441,6 +442,11 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
if (vps->vps_poc_proportional_to_timing_flag)
vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
vps->vps_num_hrd_parameters = get_ue_golomb_long(gb);
if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) {
av_log(s->avctx, AV_LOG_ERROR,
"vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters);
goto err;
}
for (i = 0; i < vps->vps_num_hrd_parameters; i++) {
int common_inf_present = 1;
@ -895,11 +901,30 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size +
sps->log2_min_tb_size;
if (sps->log2_min_tb_size >= sps->log2_min_cb_size) {
if (sps->log2_min_cb_size < 3 || sps->log2_min_cb_size > 30) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value %d for log2_min_cb_size", sps->log2_min_cb_size);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (sps->log2_diff_max_min_coding_block_size > 30) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value %d for log2_diff_max_min_coding_block_size", sps->log2_diff_max_min_coding_block_size);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (sps->log2_min_tb_size >= sps->log2_min_cb_size || sps->log2_min_tb_size < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value for log2_min_tb_size");
ret = AVERROR_INVALIDDATA;
goto err;
}
if (log2_diff_max_min_transform_block_size < 0 || log2_diff_max_min_transform_block_size > 30) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid value %d for log2_diff_max_min_transform_block_size", log2_diff_max_min_transform_block_size);
ret = AVERROR_INVALIDDATA;
goto err;
}
sps->max_transform_hierarchy_depth_inter = get_ue_golomb_long(gb);
sps->max_transform_hierarchy_depth_intra = get_ue_golomb_long(gb);
@ -1021,7 +1046,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
(sps->output_window.left_offset + sps->output_window.right_offset);
sps->output_height = sps->height -
(sps->output_window.top_offset + sps->output_window.bottom_offset);
if (sps->output_width <= 0 || sps->output_height <= 0) {
if (sps->width <= sps->output_window.left_offset + (int64_t)sps->output_window.right_offset ||
sps->height <= sps->output_window.top_offset + (int64_t)sps->output_window.bottom_offset) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid visible frame dimensions: %dx%d.\n",
sps->output_width, sps->output_height);
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
@ -1255,6 +1281,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (pps->cu_qp_delta_enabled_flag)
pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb);
if (pps->diff_cu_qp_delta_depth < 0 ||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
av_log(s->avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
pps->diff_cu_qp_delta_depth);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->cb_qp_offset = get_se_golomb(gb);
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
@ -1281,14 +1315,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
if (pps->tiles_enabled_flag) {
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
if (pps->num_tile_columns == 0 ||
if (pps->num_tile_columns <= 0 ||
pps->num_tile_columns >= sps->width) {
av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
pps->num_tile_columns - 1);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (pps->num_tile_rows == 0 ||
if (pps->num_tile_rows <= 0 ||
pps->num_tile_rows >= sps->height) {
av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
pps->num_tile_rows - 1);

View File

@ -126,6 +126,11 @@ static int active_parameter_sets(HEVCContext *s)
get_bits(gb, 1); // num_sps_ids_minus1
num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
if (num_sps_ids_minus1 < 0 || num_sps_ids_minus1 > 15) {
av_log(s->avctx, AV_LOG_ERROR, "num_sps_ids_minus1 %d invalid\n", num_sps_ids_minus1);
return AVERROR_INVALIDDATA;
}
active_seq_parameter_set_id = get_ue_golomb_long(gb);
if (active_seq_parameter_set_id >= MAX_SPS_COUNT) {
av_log(s->avctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);

View File

@ -94,7 +94,7 @@ typedef struct Indeo3DecodeContext {
int16_t width, height;
uint32_t frame_num; ///< current frame number (zero-based)
uint32_t data_size; ///< size of the frame data in bytes
int data_size; ///< size of the frame data in bytes
uint16_t frame_flags; ///< frame properties
uint8_t cb_offset; ///< needed for selecting VQ tables
uint8_t buf_sel; ///< active frame buffer: 0 - primary, 1 -secondary
@ -899,7 +899,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
GetByteContext gb;
const uint8_t *bs_hdr;
uint32_t frame_num, word2, check_sum, data_size;
uint32_t y_offset, u_offset, v_offset, starts[3], ends[3];
int y_offset, u_offset, v_offset;
uint32_t starts[3], ends[3];
uint16_t height, width;
int i, j;
@ -981,7 +982,8 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
ctx->y_data_size = ends[0] - starts[0];
ctx->v_data_size = ends[1] - starts[1];
ctx->u_data_size = ends[2] - starts[2];
if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
if (FFMIN3(y_offset, v_offset, u_offset) < 0 ||
FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 ||
FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) {
av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n");

View File

@ -1559,7 +1559,7 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
int cn = bytestream2_get_be16(&s->g);
int av_unused typ = bytestream2_get_be16(&s->g);
int asoc = bytestream2_get_be16(&s->g);
if (cn < 4 || asoc < 4)
if (cn < 4 && asoc < 4)
s->cdef[cn] = asoc;
}
}

View File

@ -43,6 +43,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
JvContext *s = avctx->priv_data;
if (!avctx->width || !avctx->height ||
(avctx->width & 7) || (avctx->height & 7)) {
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
avctx->width, avctx->height);
return AVERROR(EINVAL);
}
s->frame = av_frame_alloc();
if (!s->frame)
return AVERROR(ENOMEM);

View File

@ -108,6 +108,8 @@ static int get_stats(AVCodecContext *avctx, int eos)
// libtheora generates a summary header at the end
memcpy(h->stats, buf, bytes);
avctx->stats_out = av_malloc(b64_size);
if (!avctx->stats_out)
return AVERROR(ENOMEM);
av_base64_encode(avctx->stats_out, b64_size, h->stats, h->stats_offset);
}
return 0;

View File

@ -441,9 +441,10 @@ static av_cold int vpx_init(AVCodecContext *avctx,
codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength);
if (ctx->arnr_type >= 0)
codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type);
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
if (avctx->codec_id == AV_CODEC_ID_VP8)
if (avctx->codec_id == AV_CODEC_ID_VP8) {
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));
}
#if FF_API_MPV_OPT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->mb_threshold) {

View File

@ -88,7 +88,12 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
if (level == 127) {
break;
} else if (level != 0) {
i += run;
i += run;
if (i > 63) {
av_log(a->avctx, AV_LOG_ERROR,
"ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
return AVERROR_INVALIDDATA;
}
j = scantable[i];
level = (level * qscale * quant_matrix[j]) >> 3;
level = (level ^ SHOW_SBITS(re, &a->gb, 1)) - SHOW_SBITS(re, &a->gb, 1);
@ -98,8 +103,13 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
run = SHOW_UBITS(re, &a->gb, 6)+1; LAST_SKIP_BITS(re, &a->gb, 6);
UPDATE_CACHE(re, &a->gb);
level = SHOW_SBITS(re, &a->gb, 10); SKIP_BITS(re, &a->gb, 10);
i += run;
j = scantable[i];
i += run;
if (i > 63) {
av_log(a->avctx, AV_LOG_ERROR,
"ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
return AVERROR_INVALIDDATA;
}
j = scantable[i];
if (level < 0) {
level = -level;
level = (level * qscale * quant_matrix[j]) >> 3;
@ -110,10 +120,6 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
level = (level - 1) | 1;
}
}
if (i > 63) {
av_log(a->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
return AVERROR_INVALIDDATA;
}
block[j] = level;
}

View File

@ -89,7 +89,7 @@ static void ff_acelp_interpolatef_mips(float *out, const float *in,
"addu %[p_filter_coeffs_m], %[p_filter_coeffs_m], %[prec] \n\t"
"madd.s %[v],%[v],%[in_val_m], %[fc_val_m] \n\t"
: [v] "=&f" (v),[p_in_p] "+r" (p_in_p), [p_in_m] "+r" (p_in_m),
: [v] "+&f" (v),[p_in_p] "+r" (p_in_p), [p_in_m] "+r" (p_in_m),
[p_filter_coeffs_p] "+r" (p_filter_coeffs_p),
[in_val_p] "=&f" (in_val_p), [in_val_m] "=&f" (in_val_m),
[fc_val_p] "=&f" (fc_val_p), [fc_val_m] "=&f" (fc_val_m),

View File

@ -182,7 +182,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n",
index, s->qscale[index]);
len -= 65;
len -= 1 + 64 * (1+pr);
}
return 0;
}
@ -561,9 +561,12 @@ unk_pixfmt:
}
if (s->ls) {
s->upscale_h = s->upscale_v = 0;
if (s->nb_components > 1)
if (s->nb_components == 3) {
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
else if (s->palette_index && s->bits <= 8)
} else if (s->nb_components != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
return AVERROR_PATCHWELCOME;
} else if (s->palette_index && s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
else if (s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
@ -1248,13 +1251,18 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if (s->interlaced && s->bottom_field)
block_offset += linesize[c] >> 1;
ptr = data[c] + block_offset;
if ( 8*(h * mb_x + x) < s->width
&& 8*(v * mb_y + y) < s->height) {
ptr = data[c] + block_offset;
} else
ptr = NULL;
if (!s->progressive) {
if (copy_mb)
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
linesize[c], s->avctx->lowres);
if (copy_mb) {
if (ptr)
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
linesize[c], s->avctx->lowres);
else {
} else {
s->bdsp.clear_block(s->block);
if (decode_block(s, s->block, i,
s->dc_index[i], s->ac_index[i],
@ -1263,9 +1271,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
"error y=%d x=%d\n", mb_y, mb_x);
return AVERROR_INVALIDDATA;
}
s->idsp.idct_put(ptr, linesize[c], s->block);
if (s->bits & 7)
shift_output(s, ptr, linesize[c]);
if (ptr) {
s->idsp.idct_put(ptr, linesize[c], s->block);
if (s->bits & 7)
shift_output(s, ptr, linesize[c]);
}
}
} else {
int block_idx = s->block_stride[c] * (v * mb_y + y) +
@ -1904,6 +1914,10 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
put_bits(&pb, 8, x);
if (x == 0xFF) {
x = src[b++];
if (x & 0x80) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
x &= 0x7f;
}
put_bits(&pb, 7, x);
bit_count--;
}

View File

@ -61,6 +61,13 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8;
if (!avctx->width || !avctx->height ||
(avctx->width & 1) || (avctx->height & 1)) {
av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
avctx->width, avctx->height);
return AVERROR(EINVAL);
}
s->frame = av_frame_alloc();
if (!s->frame)
return AVERROR(ENOMEM);

View File

@ -101,7 +101,7 @@ enum AudioObjectType {
AOT_USAC, ///< N Unified Speech and Audio Coding
};
#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
#define MAX_PCE_SIZE 320 ///<Maximum size of a PCE including the 3-bit ID_PCE
///<marker and the comment
int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);

View File

@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
int x = 0, y = 0;
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
if (length)
if (length > 0)
x = get_xbits(gb, length);
if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
skip_bits1(gb); /* marker bit */
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
if (length)
if (length > 0)
y = get_xbits(gb, length);
skip_bits1(gb); /* marker bit */

View File

@ -428,9 +428,11 @@ static av_cold int decode_init(AVCodecContext * avctx)
s->avctx = avctx;
#if USE_FLOATS
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
if (!s->fdsp)
return AVERROR(ENOMEM);
#endif
ff_mpadsp_init(&s->mpadsp);

View File

@ -883,7 +883,7 @@ extern const uint8_t ff_aic_dc_scale_table[32];
extern const uint8_t ff_h263_chroma_qscale_table[32];
/* rv10.c */
void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
int ff_rv_decode_dc(MpegEncContext *s, int n);
void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number);

View File

@ -395,18 +395,18 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
switch(avctx->codec_id) {
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384;
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112LL / 15000000 * 16384;
break;
case AV_CODEC_ID_MPEG4:
case AV_CODEC_ID_MSMPEG4V1:
case AV_CODEC_ID_MSMPEG4V2:
case AV_CODEC_ID_MSMPEG4V3:
if (avctx->rc_max_rate >= 15000000) {
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000L) * (760-320) / (38400000 - 15000000);
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000LL) * (760-320) / (38400000 - 15000000);
} else if(avctx->rc_max_rate >= 2000000) {
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000L) * (320- 80) / (15000000 - 2000000);
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000LL) * (320- 80) / (15000000 - 2000000);
} else if(avctx->rc_max_rate >= 384000) {
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000L) * ( 80- 40) / ( 2000000 - 384000);
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000LL) * ( 80- 40) / ( 2000000 - 384000);
} else
avctx->rc_buffer_size = 40;
avctx->rc_buffer_size *= 16384;
@ -3706,8 +3706,11 @@ static int encode_picture(MpegEncContext *s, int picture_number)
ff_msmpeg4_encode_picture_header(s, picture_number);
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
ff_mpeg4_encode_picture_header(s, picture_number);
else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10)
ff_rv10_encode_picture_header(s, picture_number);
else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
ret = ff_rv10_encode_picture_header(s, picture_number);
if (ret < 0)
return ret;
}
else if (CONFIG_RV20_ENCODER && s->codec_id == AV_CODEC_ID_RV20)
ff_rv20_encode_picture_header(s, picture_number);
else if (CONFIG_FLV_ENCODER && s->codec_id == AV_CODEC_ID_FLV1)

View File

@ -178,7 +178,7 @@ static void gmc_motion(MpegEncContext *s,
s->sprite_delta[0][0], s->sprite_delta[0][1],
s->sprite_delta[1][0], s->sprite_delta[1][1],
a + 1, (1 << (2 * a + 1)) - s->no_rounding,
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
(s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
ptr = ref_picture[2];
s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8,
@ -186,7 +186,7 @@ static void gmc_motion(MpegEncContext *s,
s->sprite_delta[0][0], s->sprite_delta[0][1],
s->sprite_delta[1][0], s->sprite_delta[1][1],
a + 1, (1 << (2 * a + 1)) - s->no_rounding,
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
(s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
}
static inline int hpel_motion(MpegEncContext *s,

View File

@ -36,17 +36,15 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
unsigned char rle_code;
unsigned char extra_byte, odd_pixel;
unsigned char stream_byte;
unsigned int pixel_ptr = 0;
int row_dec = pic->linesize[0];
int row_ptr = (avctx->height - 1) * row_dec;
int frame_size = row_dec * avctx->height;
int pixel_ptr = 0;
int line = avctx->height - 1;
int i;
while (row_ptr >= 0) {
while (line >= 0 && pixel_ptr <= avctx->width) {
if (bytestream2_get_bytes_left(gb) <= 0) {
av_log(avctx, AV_LOG_ERROR,
"MS RLE: bytestream overrun, %d rows left\n",
row_ptr);
"MS RLE: bytestream overrun, %dx%d left\n",
avctx->width - pixel_ptr, line);
return AVERROR_INVALIDDATA;
}
rle_code = stream_byte = bytestream2_get_byteu(gb);
@ -55,7 +53,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
stream_byte = bytestream2_get_byte(gb);
if (stream_byte == 0) {
/* line is done, goto the next one */
row_ptr -= row_dec;
line--;
pixel_ptr = 0;
} else if (stream_byte == 1) {
/* decode is done */
@ -65,13 +63,12 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
stream_byte = bytestream2_get_byte(gb);
pixel_ptr += stream_byte;
stream_byte = bytestream2_get_byte(gb);
row_ptr -= stream_byte * row_dec;
} else {
// copy pixels from encoded stream
odd_pixel = stream_byte & 1;
rle_code = (stream_byte + 1) / 2;
extra_byte = rle_code & 0x01;
if (row_ptr + pixel_ptr + stream_byte > frame_size ||
if (pixel_ptr + 2*rle_code - odd_pixel > avctx->width ||
bytestream2_get_bytes_left(gb) < rle_code) {
av_log(avctx, AV_LOG_ERROR,
"MS RLE: frame/stream ptr just went out of bounds (copy)\n");
@ -82,13 +79,13 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
if (pixel_ptr >= avctx->width)
break;
stream_byte = bytestream2_get_byteu(gb);
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
pixel_ptr++;
if (i + 1 == rle_code && odd_pixel)
break;
if (pixel_ptr >= avctx->width)
break;
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
pixel_ptr++;
}
@ -98,7 +95,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
}
} else {
// decode a run of data
if (row_ptr + pixel_ptr + stream_byte > frame_size) {
if (pixel_ptr + rle_code > avctx->width + 1) {
av_log(avctx, AV_LOG_ERROR,
"MS RLE: frame ptr just went out of bounds (run)\n");
return AVERROR_INVALIDDATA;
@ -108,9 +105,9 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
if (pixel_ptr >= avctx->width)
break;
if ((i & 1) == 0)
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
else
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
pixel_ptr++;
}
}

View File

@ -308,7 +308,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int
apply_mdct(s);
init_put_bits(&pb, output, output_size * 8);
init_put_bits(&pb, output, output_size);
i = 0;
for (band = 0; band < NELLY_BANDS; band++) {

View File

@ -119,12 +119,12 @@ static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)
run_len = 1;
do {
run = get_bits(gb, bits_per_sect);
if (run > num_bands - band - run_len) {
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
return AVERROR_INVALIDDATA;
}
run_len += run;
} while (run == esc_val);
if (band + run_len > num_bands) {
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
return AVERROR_INVALIDDATA;
}
for (i = band; i < band + run_len; i++) {
c->band_type[i] = band_type;
c->band_run_end[i] = band + run_len;

View File

@ -103,7 +103,6 @@ static const AVOption avcodec_options[] = {
{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},

View File

@ -451,6 +451,14 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
int coded_samples = 0;
int decoded_samples = 0;
int i, ret;
int delayed_samples = 0;
for (i = 0; i < c->nb_streams; i++) {
OpusStreamContext *s = &c->streams[i];
s->out[0] =
s->out[1] = NULL;
delayed_samples = FFMAX(delayed_samples, s->delayed_samples);
}
/* decode the header of the first sub-packet to find out the sample count */
if (buf) {
@ -464,7 +472,7 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
}
frame->nb_samples = coded_samples + c->streams[0].delayed_samples;
frame->nb_samples = coded_samples + delayed_samples;
/* no input or buffered data => nothing to do */
if (!frame->nb_samples) {

View File

@ -617,7 +617,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1 && avctx->codec_id != AV_CODEC_ID_APNG) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
@ -963,7 +963,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
AVDictionary *metadata = NULL;
uint32_t tag, length;
int decode_next_dat = 0;
int ret = AVERROR_INVALIDDATA;
int ret;
AVFrame *ref;
for (;;) {
@ -979,12 +979,14 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
if ( s->state & PNG_ALLIMAGE
&& avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
goto exit_loop;
ret = AVERROR_INVALIDDATA;
goto fail;
}
length = bytestream2_get_be32(&s->gb);
if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {
av_log(avctx, AV_LOG_ERROR, "chunk too big\n");
ret = AVERROR_INVALIDDATA;
goto fail;
}
tag = bytestream2_get_le32(&s->gb);
@ -996,11 +998,11 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
((tag >> 24) & 0xff), length);
switch (tag) {
case MKTAG('I', 'H', 'D', 'R'):
if (decode_ihdr_chunk(avctx, s, length) < 0)
if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0)
goto fail;
break;
case MKTAG('p', 'H', 'Y', 's'):
if (decode_phys_chunk(avctx, s) < 0)
if ((ret = decode_phys_chunk(avctx, s)) < 0)
goto fail;
break;
case MKTAG('f', 'c', 'T', 'L'):
@ -1013,15 +1015,17 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
case MKTAG('f', 'd', 'A', 'T'):
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
goto skip_tag;
if (!decode_next_dat)
if (!decode_next_dat) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
bytestream2_get_be32(&s->gb);
length -= 4;
/* fallthrough */
case MKTAG('I', 'D', 'A', 'T'):
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)
goto skip_tag;
if (decode_idat_chunk(avctx, s, length, p) < 0)
if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0)
goto fail;
break;
case MKTAG('P', 'L', 'T', 'E'):
@ -1046,6 +1050,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
if (!(s->state & PNG_ALLIMAGE))
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
bytestream2_skip(&s->gb, 4); /* crc */
@ -1065,7 +1070,7 @@ exit_loop:
/* handle p-frames only if a predecessor frame is available */
ref = s->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
s->previous_picture.f : s->last_picture.f;
if (ref->data[0]) {
if (ref->data[0] && s->last_picture.f->data[0]) {
if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")
&& ref->width == p->width
&& ref->height== p->height

View File

@ -209,16 +209,26 @@ static void idct_add_altivec(uint8_t *dest, int stride, int16_t *blk)
IDCT;
#if HAVE_BIGENDIAN
p0 = vec_lvsl(0, dest);
p1 = vec_lvsl(stride, dest);
p = vec_splat_u8(-1);
perm0 = vec_mergeh(p, p0);
perm1 = vec_mergeh(p, p1);
#endif
#if HAVE_BIGENDIAN
#define GET_TMP2(dest, prm) \
tmp = vec_ld(0, dest); \
tmp2 = (vec_s16) vec_perm(tmp, (vec_u8) zero, prm);
#else
#define GET_TMP2(dest, prm) \
tmp = vec_vsx_ld(0, dest); \
tmp2 = (vec_s16) vec_mergeh(tmp, (vec_u8) zero)
#endif
#define ADD(dest, src, perm) \
/* *(uint64_t *) &tmp = *(uint64_t *) dest; */ \
tmp = vec_ld(0, dest); \
tmp2 = (vec_s16) vec_perm(tmp, (vec_u8) zero, perm); \
GET_TMP2(dest, perm); \
tmp3 = vec_adds(tmp2, src); \
tmp = vec_packsu(tmp3, tmp3); \
vec_ste((vec_u32) tmp, 0, (unsigned int *) dest); \

View File

@ -55,7 +55,7 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size)
/* Sum up the four partial sums, and put the result into s. */
sum = vec_sums((vector signed int) sv, (vector signed int) zero);
sum = vec_splat(sum, 3);
vec_vsx_st(sum, 0, &s);
vec_ste(sum, 0, &s);
return s;
}
#else
@ -113,7 +113,7 @@ static int pix_sum_altivec(uint8_t *pix, int line_size)
/* Sum up the four partial sums, and put the result into s. */
sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
sumdiffs = vec_splat(sumdiffs, 3);
vec_vsx_st(sumdiffs, 0, &s);
vec_ste(sumdiffs, 0, &s);
return s;
}
#else

View File

@ -304,16 +304,23 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, int16_t *block)
src2 = vec_pack(s2, sA);
src3 = vec_pack(s3, sB);
#if HAVE_BIGENDIAN
p0 = vec_lvsl (0, dest);
p1 = vec_lvsl (stride, dest);
p = vec_splat_u8 (-1);
perm0 = vec_mergeh (p, p0);
perm1 = vec_mergeh (p, p1);
#define GET_TMP2(dst, p) \
tmp = vec_ld (0, dest); \
tmp2 = (vector signed short)vec_perm (tmp, vec_splat_u8(0), p);
#else
#define GET_TMP2(dst,p) \
tmp = vec_vsx_ld (0, dst); \
tmp2 = (vector signed short)vec_mergeh (tmp, vec_splat_u8(0));
#endif
#define ADD(dest,src,perm) \
/* *(uint64_t *)&tmp = *(uint64_t *)dest; */ \
tmp = vec_ld (0, dest); \
tmp2 = (vector signed short)vec_perm (tmp, vec_splat_u8(0), perm); \
GET_TMP2(dest, perm); \
tmp3 = vec_adds (tmp2, src); \
tmp = vec_packsu (tmp3, tmp3); \
vec_ste ((vector unsigned int)tmp, 0, (unsigned int *)dest); \

View File

@ -32,8 +32,13 @@
static const vec_s16 constants =
{0, 64277, 60547, 54491, 46341, 36410, 25080, 12785};
#if HAVE_BIGENDIAN
static const vec_u8 interleave_high =
{0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29};
#else
static const vec_u8 interleave_high =
{2, 3, 18, 19, 6, 7, 22, 23, 10, 11, 26, 27, 14, 15, 30, 31};
#endif
#define IDCT_START \
vec_s16 A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;\
@ -156,9 +161,18 @@ static void vp3_idct_add_altivec(uint8_t *dst, int stride, int16_t block[64])
TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
IDCT_1D(ADD8, SHIFT4)
#define ADD(a)\
#if HAVE_BIGENDIAN
#define GET_VDST16\
vdst = vec_ld(0, dst);\
vdst_16 = (vec_s16)vec_perm(vdst, zero_u8v, vdst_mask);\
vdst_16 = (vec_s16)vec_perm(vdst, zero_u8v, vdst_mask);
#else
#define GET_VDST16\
vdst = vec_vsx_ld(0,dst);\
vdst_16 = (vec_s16)vec_mergeh(vdst, zero_u8v);
#endif
#define ADD(a)\
GET_VDST16;\
vdst_16 = vec_adds(a, vdst_16);\
t = vec_packsu(vdst_16, vdst_16);\
vec_ste((vec_u32)t, 0, (unsigned int *)dst);\

View File

@ -59,17 +59,30 @@ static const vec_s8 h_subpel_filters_outer[3] =
vec_s8 filter_outerh = h_subpel_filters_outer[(i)>>1]; \
vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2)
#if HAVE_BIGENDIAN
#define GET_PIXHL(offset) \
a = vec_ld((offset)-is6tap-1, src); \
b = vec_ld((offset)-is6tap-1+15, src); \
pixh = vec_perm(a, b, permh##offset); \
pixl = vec_perm(a, b, perml##offset)
#define GET_OUTER(offset) outer = vec_perm(a, b, perm_6tap##offset)
#else
#define GET_PIXHL(offset) \
a = vec_vsx_ld((offset)-is6tap-1, src); \
pixh = vec_perm(a, a, perm_inner); \
pixl = vec_perm(a, a, vec_add(perm_inner, vec_splat_u8(4)))
#define GET_OUTER(offset) outer = vec_perm(a, a, perm_outer)
#endif
#define FILTER_H(dstv, off) \
a = vec_ld((off)-is6tap-1, src); \
b = vec_ld((off)-is6tap-1+15, src); \
\
pixh = vec_perm(a, b, permh##off); \
pixl = vec_perm(a, b, perml##off); \
GET_PIXHL(off); \
filth = vec_msum(filter_inner, pixh, c64); \
filtl = vec_msum(filter_inner, pixl, c64); \
\
if (is6tap) { \
outer = vec_perm(a, b, perm_6tap##off); \
GET_OUTER(off); \
filth = vec_msum(filter_outerh, outer, filth); \
filtl = vec_msum(filter_outerl, outer, filtl); \
} \
@ -84,9 +97,12 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
int h, int mx, int w, int is6tap)
{
LOAD_H_SUBPEL_FILTER(mx-1);
vec_u8 align_vec0, align_vec8, permh0, permh8, filt;
#if HAVE_BIGENDIAN
vec_u8 align_vec0, align_vec8, permh0, permh8;
vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
vec_u8 a, b, pixh, pixl, outer;
vec_u8 b;
#endif
vec_u8 filt, a, pixh, pixl, outer;
vec_s16 f16h, f16l;
vec_s32 filth, filtl;
@ -97,6 +113,7 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
vec_u16 c7 = vec_splat_u16(7);
#if HAVE_BIGENDIAN
align_vec0 = vec_lvsl( -is6tap-1, src);
align_vec8 = vec_lvsl(8-is6tap-1, src);
@ -107,6 +124,7 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
#endif
while (h --> 0) {
FILTER_H(f16h, 0);
@ -164,6 +182,12 @@ static const vec_u8 v_subpel_filters[7] =
dstv = vec_adds(dstv, c64); \
dstv = vec_sra(dstv, c7)
#if HAVE_BIGENDIAN
#define LOAD_HL(off, s, perm) load_with_perm_vec(off, s, perm)
#else
#define LOAD_HL(off, s, perm) vec_mergeh(vec_vsx_ld(off,s), vec_vsx_ld(off+8,s))
#endif
static av_always_inline
void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
uint8_t *src, ptrdiff_t src_stride,
@ -175,6 +199,7 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
vec_s16 c64 = vec_sl(vec_splat_s16(1), vec_splat_u16(6));
vec_u16 c7 = vec_splat_u16(7);
#if HAVE_BIGENDIAN
// we want pixels 0-7 to be in the even positions and 8-15 in the odd,
// so combine this permute with the alignment permute vector
align_vech = vec_lvsl(0, src);
@ -183,22 +208,23 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
perm_vec = vec_mergeh(align_vech, align_vecl);
else
perm_vec = vec_mergeh(align_vech, align_vech);
#endif
if (is6tap)
s0 = load_with_perm_vec(-2*src_stride, src, perm_vec);
s1 = load_with_perm_vec(-1*src_stride, src, perm_vec);
s2 = load_with_perm_vec( 0*src_stride, src, perm_vec);
s3 = load_with_perm_vec( 1*src_stride, src, perm_vec);
s0 = LOAD_HL(-2*src_stride, src, perm_vec);
s1 = LOAD_HL(-1*src_stride, src, perm_vec);
s2 = LOAD_HL( 0*src_stride, src, perm_vec);
s3 = LOAD_HL( 1*src_stride, src, perm_vec);
if (is6tap)
s4 = load_with_perm_vec( 2*src_stride, src, perm_vec);
s4 = LOAD_HL( 2*src_stride, src, perm_vec);
src += (2+is6tap)*src_stride;
while (h --> 0) {
if (is6tap)
s5 = load_with_perm_vec(0, src, perm_vec);
s5 = LOAD_HL(0, src, perm_vec);
else
s4 = load_with_perm_vec(0, src, perm_vec);
s4 = LOAD_HL(0, src, perm_vec);
FILTER_V(f16h, vec_mule);
@ -272,39 +298,25 @@ EPEL_HV(4, 4,4)
static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, uint8_t *src, ptrdiff_t sstride, int h, int mx, int my)
{
register vector unsigned char pixelsv1, pixelsv2;
register vector unsigned char pixelsv1B, pixelsv2B;
register vector unsigned char pixelsv1C, pixelsv2C;
register vector unsigned char pixelsv1D, pixelsv2D;
register vector unsigned char perm = vec_lvsl(0, src);
register vector unsigned char perm;
int i;
register ptrdiff_t dstride2 = dstride << 1, sstride2 = sstride << 1;
register ptrdiff_t dstride3 = dstride2 + dstride, sstride3 = sstride + sstride2;
register ptrdiff_t dstride4 = dstride << 2, sstride4 = sstride << 2;
#if HAVE_BIGENDIAN
perm = vec_lvsl(0, src);
#endif
// hand-unrolling the loop by 4 gains about 15%
// mininum execution time goes from 74 to 60 cycles
// it's faster than -funroll-loops, but using
// -funroll-loops w/ this is bad - 74 cycles again.
// all this is on a 7450, tuning for the 7450
for (i = 0; i < h; i += 4) {
pixelsv1 = vec_ld( 0, src);
pixelsv2 = vec_ld(15, src);
pixelsv1B = vec_ld(sstride, src);
pixelsv2B = vec_ld(15 + sstride, src);
pixelsv1C = vec_ld(sstride2, src);
pixelsv2C = vec_ld(15 + sstride2, src);
pixelsv1D = vec_ld(sstride3, src);
pixelsv2D = vec_ld(15 + sstride3, src);
vec_st(vec_perm(pixelsv1, pixelsv2, perm),
0, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1B, pixelsv2B, perm),
dstride, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1C, pixelsv2C, perm),
dstride2, (unsigned char*)dst);
vec_st(vec_perm(pixelsv1D, pixelsv2D, perm),
dstride3, (unsigned char*)dst);
vec_st(load_with_perm_vec(0, src, perm), 0, dst);
vec_st(load_with_perm_vec(sstride, src, perm), dstride, dst);
vec_st(load_with_perm_vec(sstride2, src, perm), dstride2, dst);
vec_st(load_with_perm_vec(sstride3, src, perm), dstride3, dst);
src += sstride4;
dst += dstride4;
}

View File

@ -183,6 +183,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
if (ctx->slice_count != slice_count || !ctx->slices) {
av_freep(&ctx->slices);
ctx->slice_count = 0;
ctx->slices = av_mallocz_array(slice_count, sizeof(*ctx->slices));
if (!ctx->slices)
return AVERROR(ENOMEM);

View File

@ -304,7 +304,7 @@ static int encode_slice_plane(AVCodecContext *avctx, int mb_count,
}
blocks_per_slice = mb_count << (2 - chroma);
init_put_bits(&pb, buf, buf_size << 3);
init_put_bits(&pb, buf, buf_size);
encode_dc_coeffs(&pb, blocks, blocks_per_slice, qmat);
encode_ac_coeffs(avctx, &pb, blocks, blocks_per_slice, qmat);

View File

@ -1058,7 +1058,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
slice_hdr = pkt->data + (slice_hdr - start);
tmp = pkt->data + (tmp - start);
}
init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)) * 8);
init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)));
ret = encode_slice(avctx, pic, &pb, sizes, x, y, q,
mbs_per_slice);
if (ret < 0)

Some files were not shown because too many files have changed in this diff Show More