Commit Graph

95090 Commits

Author SHA1 Message Date
Andreas Rheinhardt
093b6894bf avcodec/mpeg12dec: Sanitize start codes earlier
The MPEG-1/2 decoder uses avpriv_find_start_code to search for start
codes and worked with the resulting start code before checking that it
is really a start code of a slice. In particular, if the picture is so
big that a slice_vertical_position_extension is present, it added the
slice_vertical_position_extension as if it had a slice. Then a left
shift is performed, without making sure that the value to be shifted is
nonnegative.
Afterwards the end result is checked, but even if a start code of a
non-slice has been found, it might pass these checks: If
slice_vertical_position_extension is present a start code <
SLICE_MIN_START_CODE can lead to a macroblock-row index that appears
valid. Furthermore, the left shift might make an invalid start code
appear valid by discarding the highest bit.
This has been fixed by checking directly after avpriv_find_start_code
has returned.

Fixes ticket #8162 (which is about the undefined left shifts).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 14:09:14 +02:00
Andreas Rheinhardt
5886153dc3 avcodec/pcm: Cosmetics
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 14:06:06 +02:00
Andreas Rheinhardt
69473bec6f avcodec/pcm: Fix undefined shifts
Fixes the acodec-pcm-u16[lb]e FATE-tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 14:02:56 +02:00
Andreas Rheinhardt
84974c6fb5 avcodec/wavpackenc: Fix undefined shifts
Fixes ticket #8161 and the acodec-wavpack FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-09-26 11:11:01 +02:00
Zhong Li
525de95679 lavc/qsv: add memory type message
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-09-26 13:44:11 +08:00
Zhong Li
74007dd86a lavc/qsv: Fix MSDK initialization failure in system memory mode
MSDK does not create internal acceleration device on Linux,
So MFXVideoCORE_SetHandle() is necessary.
It has been added for ff_qsv_init_session_device().
But missed for ff_qsv_init_internal_session() due to commit
1f26a23 overwrited commit db89f45

Fix #7030

Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-09-26 13:44:02 +08:00
Andreas Rheinhardt
b6be2be765 avformat/utils: ensure that all packets in AVPacketList are reference counted
This is done so that its data is really owned by the packet.
This was already true for the current callers.

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 21:54:18 -03:00
Ting Fu
4f589d668e avfilter/x86/vf_eq: add SSE2 version
Signed-off-by: Ting Fu <ting.fu@intel.com>
2019-09-26 08:12:36 +08:00
Ting Fu
6aff2042d6 avfilter/x86/vf_eq: Change inline assembly into nasm code
Signed-off-by: Ting Fu <ting.fu@intel.com>
2019-09-26 08:11:13 +08:00
Ting Fu
9691e2a426 checkasm/vf_eq: add test for vf_eq
Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2019-09-26 08:10:31 +08:00
Andreas Rheinhardt
fc20ba9e04 avformat/utils: Move the reference to the packet list
Up until now, ff_packet_list_put had a flaw: When it moved a packet to
the list (meaning, when it ought to move the reference to the packet
list instead of creating a new one via av_packet_ref), it did not reset
the original packet, confusing the ownership of the data in the packet.
This has been done because some callers of this function were not
compatible with resetting the packet.

This commit changes these callers and fixes this flaw. In order to
indicate that the ownership of the packet has moved to the packet list,
pointers to constant AVPackets are used whenever the target of the
pointer might already be owned by the packet list.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 20:53:09 -03:00
James Almer
bae8844e35 avformat/utils: unref packet on AVInputFormat.read_packet() failure
Demuxers may have allocated a packet before encountering an error and aborting.

Fixes ticket #8150

Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 20:53:05 -03:00
Andreas Rheinhardt
66d5e43b99 avformat/utils: Fix memleaks
ff_read_packet had potential memleaks:
1. If av_packet_make_refcounted fails, it means that the packet is not
refcounted, but it could nevertheless carry side data and therefore
needs to be unreferenced.
2. If putting a packet on a packet list fails, it wasn't unreferenced.

Furthermore, read_frame_internal leaked a packet's (side) data if a
context update was required and failed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 20:53:01 -03:00
Andreas Rheinhardt
e045be92cd avformat/utils: Assert that stream_index is valid
There is currently an ordinary check for this (which would lead to a
memleak), but given that no demuxer should ever return a packet with an
invalid stream_index it is more appropriate for this to be an assert.

FATE passes with this change.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 20:53:01 -03:00
Jun Li
c23797bc33 lavf/mov: Fix timestamp rescale on sidx atom
Fix #5090
Fix the timestamp rescale issue, from sidx timebase to
stream's timebase.
2019-09-26 06:55:44 +08:00
Carl Eugen Hoyos
dbd3dbb476 Revert "lavc/tiff: correct the default value of YCbCrSubsampling to 2x2"
This reverts commit eb5d0f18ff.

Together with 89f464e9, it breaks decoding of tiff files like fate-suite/exif/image_small.tiff
2019-09-26 00:34:44 +02:00
Limin Wang
3def984a98 avcodec/dnxhdenc: return error if av_malloc failed
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-25 17:56:44 -03:00
Paul B Mahol
ced3b8c61e avfilter/vf_zoompan: fix leaks 2019-09-25 21:48:59 +02:00
Paul B Mahol
20242bc762 avfilter/vf_zoompan: forward status back from output to input 2019-09-25 21:37:26 +02:00
Paul B Mahol
631f7acc6c avfilter/vf_stack: add slice threading 2019-09-25 19:02:57 +02:00
Paul B Mahol
44095564d4 avfilter/vf_stack: simplify main processing path 2019-09-25 18:40:56 +02:00
Paul B Mahol
1a17a66b09 avformat/sdsdec: fix undefined behaviour
Fixes #8163, #8164, #8165.
2019-09-25 18:01:09 +02:00
Paul B Mahol
d58752bcb9 avformat/aiffdec: fix signed integer overflow
Fixes #8151
2019-09-25 17:40:50 +02:00
Michael Niedermayer
121bf1b3b8 avcodec/decode: Check max_samples in get_buffer_internal()
This checks max_samples at the same level as max_pixels

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-25 17:21:23 +02:00
Michael Niedermayer
68c80dc312 tools/target_dec_fuzzer: Set max_samples
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-25 17:18:37 +02:00
Michael Niedermayer
f8406ab4b9 avcodec: add max_samples
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-25 17:18:37 +02:00
Paul B Mahol
402dbd4633 avfilter/Makefile: fix case for sierpinski 2019-09-25 14:15:55 +02:00
Paul B Mahol
9c3e1c1937 avfilter: add sierpinski video source 2019-09-25 14:06:26 +02:00
Paul B Mahol
55b32584b8 avfilter/vf_premultiply: forward status back from output to all input links 2019-09-25 13:07:04 +02:00
Paul B Mahol
da9890f6c7 avfilter/vf_fieldmatch: forward status back from output to all input links
Fixes #8199.
2019-09-25 13:07:04 +02:00
Paul B Mahol
2962101e40 avfilter/vf_fieldmatch: fix more leaks 2019-09-25 13:06:30 +02:00
Paul B Mahol
0d05aa052c avfilter/vf_v360: add sinusoidal format 2019-09-25 13:06:30 +02:00
Pavel Skakov
eb5d0f18ff lavc/tiff: correct the default value of YCbCrSubsampling to 2x2 2019-09-25 10:47:46 +02:00
Jun Zhao
5f13859873 lavf/4xm: fix memory leak in error handing path
need to free the header in error path.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-09-25 11:23:03 +08:00
Guo, Yejun
85e338ab0d libavcodec/libx265: add a flag to output ROI warnings only once.
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2019-09-24 17:22:15 +01:00
Guo, Yejun
104d44138b libavcodec/libx264: add a flag to output ROI warnings only once.
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2019-09-24 17:22:15 +01:00
Michael Niedermayer
95e5396919 avcodec/utils: Optimize ff_color_frame() using memcpy()
4650975 -> 4493240 dezicycles

This optimizes lines 2 and later. Line 1 still uses av_memcpy_backptr()
This change originally fixed ossfuzz 10790 but this is now fixed by other
optimizations already

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
3dce4d03d5 avcodec/aacdec: Check if we run out of input in read_stream_mux_config()
Fixes: Infinite loop
Fixes: 16920/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5653421289373696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
1e984a6915 avcodec/h264_slice: clear frame only on gaps when it is not otherwise initilaized
Fixes: Timeout (53sec -> 31sec)
Fixes: 16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
340ab13504 avcodec/utils: Use av_memcpy_backptr() in ff_color_frame()
Fixes: Timeout (191sec -> 53sec)
Fixes: 16908/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5711207859748864
Fixes: 10709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5630617975259136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
033d2c4884 avcodec/smacker: Fix integer overflow in signed int multiply in SMK_BLK_FILL
Fixes: signed integer overflow: 238 * 16843009 cannot be represented in type 'int'
Fixes: 16958/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5193905355620352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
b30c07cc2b avcodec/alac: Fix invalid shifts in 20/24 bps
Fixes: left shift of negative value -256
Fixes: 16892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-4880802642395136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
0831cbfe09 avcodec/alac: fix undefined behavior with INT_MIN in lpc_prediction()
Fixes: signed integer overflow: -2147483648 * -1 cannot be represented in type 'int'
Fixes: 16786/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5632818851348480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
72db18e929 avformat/utils: Do not assume duration is non negative in compute_pkt_fields()
Several subtitle demuxers set negative durations

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 16925/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5766519790764032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
c7ccbf40ed avcodec/ffwavesynth: Fix integer overflow in timestamps
Fixes: signed integer overflow: 9223371075321077760 * 2 cannot be represented in type 'long'
Fixes: 16447/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5698937431785472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
27a2f65948 avformat/vividas: Test size and packet numbers a bit more
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
8e51f35f81 avformat/vividas: Check n_sb_blocks against input space
Fixes: OOM
Fixes: 16726/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5719320750981120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
cede385018 avcodec/aacdec_fixed: Add FF_CODEC_CAP_INIT_CLEANUP
Fixes: memleaks
Fixes: 16788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5649873898045440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
59163731e9 tools/target_dec_fuzzer: consider potential padding/edge in pixel threshold
Fixes: Timeout (73sec ->30ms)
Fixes: 16921/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5689384594046976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00
Michael Niedermayer
d217691eec libavcodec/mpeg12dec: Check input for minimal frame size
Fixes: Timeout (35sec -> 6sec)
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5729024726269952
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5642388592132096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-24 17:53:39 +02:00