Commit Graph

104926 Commits

Author SHA1 Message Date
Paul B Mahol
a8a7c5d502 avcodec/thd: fix special stereo support 2021-12-18 10:20:24 +01:00
Paul B Mahol
8718f8cfaf avcodec/cdgraphics: fix transparency handling 2021-12-18 10:20:24 +01:00
Paul B Mahol
1c49d74fad avcodec/cdgraphics: unbreak rendering of vertical scrolling 2021-12-18 10:20:24 +01:00
Michael Niedermayer
68457c1e85 avcodec/alacdsp: fix integer overflow in decorrelate_stereo()
Fixes: signed integer overflow: -16777216 * 131 cannot be represented in type 'int'
Fixes: 23835/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5669943160078336
Fixes: 41101/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-4636330705944576

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-17 16:15:20 +01:00
Anton Khirnov
b780b6db64 lavc/encode: set frame_number for encoders using receive_packet()
It is currently set in encode_simple_internal(), which is only called
for encoders using the "simple" encoding API.
2021-12-17 10:24:34 +01:00
Anton Khirnov
67aceaf4ad lavc/encode: improve the empty frame check
Test for buf[0] rather than data[0] (which is broken for some hwaccel
formats).
2021-12-17 10:24:28 +01:00
Anton Khirnov
fe31708eaa lavf/sdp: add more thorough error handling
Return error codes when constructing a stream config fails, rather than
just disregarding the failure and continuing.
Propagate the error codes from av_sdp_create().
2021-12-17 10:23:07 +01:00
Anton Khirnov
b0518f9977 lavf/sdp: reindent switch() according to our conventions 2021-12-17 10:22:46 +01:00
Anton Khirnov
230646751d lavf/sdp: add const qualifiers where appropriate
Declares that these structs are read-only for this code.
2021-12-17 10:22:41 +01:00
Andreas Rheinhardt
3c9778d342 avcodec/mpegvideo_enc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
a595717d21 avcodec/mpegvideo_enc: Remove some impossible branches
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
9f906f3114 avcodec/mpegvideo_enc: Combine some checks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
090cd1394f avcodec/mpegvideo: Reindentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
f860dfe555 avcodec/h263: Remove declaration of inexistent function
Forgotten in c46eeae2a8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
9088cc6df9 avcodec/mpegvideo: Allocate several buffers jointly
Reduces the amount of allocations and frees.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
2ac3e32802 avcodec/mpegvideo: Don't allocate encoder-only buffers when decoding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:52 +01:00
Andreas Rheinhardt
b72723d415 avcodec/mpegvideo_enc, vc1dec: Remove always-false check
Mpeg1EncContext.droppable is only nonzero for the FLV decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 02:54:45 +01:00
Andreas Rheinhardt
0abdf63ae7 avcodec/mpegvideo: Don't update encoder-only fields for decoders
ff_mpeg_update_thread_context() is only used by decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 01:53:50 +01:00
Andreas Rheinhardt
81c6b8ffe8 avcodec/mpegvideo: Move closed_gop to Mpeg1Context
Only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-17 01:53:50 +01:00
Michael Niedermayer
dd94912479 avformat/4xm: Check for duplicate track ids
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
0dcd95ef8a avformat/4xm: Consider max_streams on reallocating tracks array
Fixes: OOM
Fixes: 41595/clusterfuzz-testcase-minimized-ffmpeg_dem_FOURXM_fuzzer-6355979363549184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
e22ec484aa avformat/cinedec: Avoid repeatedly allocating packets beyond the input
Fixes: Timeout
Fixes: 41025/clusterfuzz-testcase-minimized-ffmpeg_dem_CINE_fuzzer-5540848285122560

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
8e96410e1b avcodec/speexdec: Avoid violating the vector_fmul_scalar() API
Fixes: out of array access
Fixes: 40054/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-6713285764841472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
562021e2fd avformat/mov: Check next offset in mov_read_dref()
Fixes: signed integer overflow: 9223372036200463215 + 1109914409 cannot be represented in type 'long'
Fixes: 41480/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6553086177443840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
bf1e93bdc9 avformat/vivo: Favor setting fps from explicit fractions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
Michael Niedermayer
7b24615565 avformat/vivo: Do not use the general expression evaluator for parsing a floating point value
Fixes: Timeout
Fixes: 41564/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVO_fuzzer-6309014024093696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 22:31:13 +01:00
James Almer
eab91c3e2e x86/scale_avx2: don't use $ for hex literals
Fixes compilation with AVX2 enabled yasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-16 17:29:21 -03:00
Michael Niedermayer
db3fd5ab31 tools/target_dec_fuzzer: Adjust threshold for prores
Fixes: Timeout
Fixes: 42072/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_fuzzer-4957999452520448

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 21:06:47 +01:00
Michael Niedermayer
99b2700f5b avformat/mvdec: Use 64 bit in timestamp computation
Fixes: division by zero
Fixes: 42198/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5054366405492736.fuzz
Fixes: 42222/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4561249331970048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-12-16 21:06:47 +01:00
Alan Kelly
9092e58c44 x86/scale_avx2: Change asm indent from 2 to 4 spaces.
Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-16 13:42:04 -03:00
Alan Kelly
86663963e6 x86/swscale: fix minor coding style issues
Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-16 13:16:04 -03:00
James Almer
76a3f961f8 x86/scale_avx2: add missing check for AVX2 assembler support
Should fix compilation with old yasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-16 09:41:56 -03:00
Andreas Rheinhardt
0ab5d7e92b avcodec/tests: Update .gitignore file
Forgotten in 136865413c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 12:25:55 +01:00
Yu Yang
a4580bf959 fftools/cmdutils: Avoid crash when opts could not be allocated
If 'opts' could not be allocated, exiting the program to avoid crash when release it.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Yu Yang <yuyang14@kuaishou.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 11:56:00 +01:00
Steven Liu
3f46ffe956 avformat/aviobuf: fix double free by return early on error
Because the s->buffer has been freed by av_freep in avio_closep.
It should not av_freep the buffer in label fail after avio_closep.
Then just move the av_freep before avio_closep and remove the label fail.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-12-16 11:02:57 +08:00
Andreas Rheinhardt
38e5ca9310 avformat/moflex: Don't use uninitialized timebase for data stream
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 03:08:10 +01:00
Andreas Rheinhardt
0a25abdacd avformat/moflex: Free AVPackets via av_packet_free() on error
(This is not a leak as long as av_free() completely frees blank
packets.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 03:06:52 +01:00
Andreas Rheinhardt
7a5f7caee9 avcodec/speedhq: Replace always-true check by assert
Should fix Coverity tickets #1473572 and #1473504.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 03:06:46 +01:00
Andreas Rheinhardt
8ff3fbf6bc avcodec/decode: Reset *got_sub_ptr on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
6e02ca35e5 avcodec/xsubdec: Use dedicated pointer for AVSubtitleRect
Improves readability and slightly reduces codesize.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
077167fab9 avcodec/xsubdec: Cleanup generically upon allocation error
This is possible by incrementing the counter of allocated rects
directly after said allocation succeeded.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
2adbb0c2af avcodec/ass: Fix leaks upon ff_ass_add_rect() error
Do this by actually incrementing the counter for the number
of rects at the right time.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
cee04cbfe1 avcodec/decode: Fix leaks upon subtitle decoding errors
Up until now, various subtitle decoders have not cleaned up
the AVSubtitle on error; this task must not be left to the user
because the documentation explicitly states that the AVSubtitle
"must be freed with avsubtitle_free if *got_sub_ptr is set"
(which it isn't on error).
Leaks happen upon failure in ff_ass_add_rect() or in
ass_decode_frame(); freeing generically also allows to remove
now redundant freeing code in pgssubdec and dvbsubdec.
While just at it, also reset got_sub_ptr generically on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
d59f454ed2 avcodec/pgssubdec: Use dedicated pointer for accesses
Improves readability and decreases codesize.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
58228ab9b9 avcodec/pgssubdec: Remove redundant freeing code
The caller of display_end_segment() frees the AVSubtitle on error
in case ENOMEM is returned or err_recognition is set to explode,
so display_end_segment() doesn't have to.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
200a372837 avcodec/pgssubdec: Always return error upon allocation error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
97e26937b4 avformat/demux: Remove redundant prevention against infinite loop
This piece of code has been added as FFmpeg's answer to
infinite loops in try_decode_frame() in commit
6072a19b4f. There is no loop
around try_decode_frame() any more, so this code can be removed.

This code is only triggered in case a) the codec parameter could
not be determined, b) the decode delay could not be guessed or
c) no packet was ever encountered and the encoder has the
AV_CODEC_CAP_CHANNEL_CONF. In these cases the new code will
no longer emit a "decoding for stream %d failed" message, which is
prima facie false. In case a) an additional "Could not find codec
parameters" message is (and will be) emitted. No warning will be
emitted any more in case b) (this happens e.g. with some
h264-conformance FATE-files).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:26 +01:00
Andreas Rheinhardt
52a4d44044 avformat/demux: Remove fake-loop
When flushing, try_decode_frame() itself loops until the desired
properties have been found or the decoder is drained.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:25 +01:00
Andreas Rheinhardt
aba4a4f080 avcodec/h2645_parse: Move ref_idc further up in H2645NAL
This puts it directly near the NALU type which is more natural
and furthermore reduces the size of the structure because it
can be placed in padding (on 64-bit systems).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:25 +01:00
Andreas Rheinhardt
c22a9ece2e avcodec/h2645_parse: Remove H2645NAL.rbsp_buffer
Forgotten in 03b82b3ab9.

(Moving data to the front is only done to make existing
initializations like H2645NAL nal = { NULL } not emit int->pointer
conversion warnings.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 02:37:25 +01:00