1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-20 03:04:12 +02:00
Commit Graph

45632 Commits

Author SHA1 Message Date
Limin Wang
c0d38beac0 avcodec/mpeg12dec: Fix usage of init_get_bits() and use init_get_bits8()
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-09 21:26:21 +08:00
Michael Niedermayer
98aec8c1b8 avcodec/h274: Fix signed left shift
Fixes: 39463/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5736517629247488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-09 11:42:16 +02:00
Michael Niedermayer
f054871a65 avcodec/h264_slice: Check idr_pic_id
Fixes: left shift of negative value -1
Fixes: 39223/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5498831521841152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-09 11:42:16 +02:00
Peter Ross
60a9d3778f avcodec: GEM Raster image decoder
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2021-10-08 20:37:36 +11:00
Limin Wang
00ec682a70 avcodec/hevcdec: set the film grain property if present
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-08 10:11:59 +08:00
Michael Niedermayer
f059b56195 avcodec/apedec: Use 64bit to avoid overflow
Fixes: runtime error: signed integer overflow: 727298502 * 3 cannot be represented in type 'int'
Fixes: 39172/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-638602483033702

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-07 23:38:57 +02:00
Michael Niedermayer
ad517ee6e4 avcodec/apedec: Fix undefined integer overflow in long_filter_ehigh_3830()
Fixes: signed integer overflow: -2145648640 - 3357696 cannot be represented in type 'int'
Fixes: 38899/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5358815017566208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-07 23:38:57 +02:00
Michael Niedermayer
cc721fc292 avcodec/amr_parser: Treat 0 channels as 1
Fixes: division by 0
Fixes: 39562/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-5448834960982016
Fixes: 39589/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMRWB_fuzzer-6119205334810624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-07 19:37:05 +02:00
Andreas Rheinhardt
5e1b5b52fe avcodec/aliaspixenc: Remove redundant counter
Improves performance by 33.8% for BGR24 and by 26.4% for GRAY8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-07 11:57:23 +02:00
Andreas Rheinhardt
c9b44a79d1 avcodec/rasc: Fix potential use of uninitialized value
Fixes Coverity issue #1439566.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-07 11:34:20 +02:00
Michael Niedermayer
07e4669053 avcodec/wmaprodec: Do not initialize unused variable to out of array value
Fixes: out of array read
Fixes: 39452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-4678745030524928.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-05 20:06:42 +02:00
Paul B Mahol
a97cad8b0b avcodec/amrnbdec: move channel_size bellow to avoid array overreads 2021-10-03 12:13:53 +02:00
Paul B Mahol
17130321f3 avcodec/mlpdec: skip decoding substreams if their channels are not to be used 2021-10-03 11:46:53 +02:00
Paul B Mahol
114634a51a avcodec/mlpdec: update matrix encoding only if it changed 2021-10-03 11:46:53 +02:00
Paul B Mahol
d2cf2cb0bd avcodec/amr*dec: reindent 2021-10-03 11:42:15 +02:00
Paul B Mahol
f282c34c00 avcodec/amr*dec: add multichannel support 2021-10-03 11:42:15 +02:00
Paul B Mahol
1f447fd954 avcodec: add amr parser 2021-10-02 18:49:40 +02:00
Andreas Rheinhardt
8ae0ef5327 avcodec/vc1_pred: Remove unused function parameter
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:35:35 +02:00
Andreas Rheinhardt
98f52efbfa avcodec/mpegaudiodec_template: Remove unused variable
Unused since 9ab0874ea8.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:35:16 +02:00
Andreas Rheinhardt
a412b5e792 avcodec/bmpenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
eec5a45f05 avcodec/dnxhdenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
30c802f3ae avcodec/dpxenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
39d28ea4d5 avcodec/magicyuvenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
c10a2959c0 avcodec/proresenc_anatoliy: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
be6da2f252 avcodec/snowenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Andreas Rheinhardt
4b1aa74de3 avcodec/magicyuvenc: Use immediate when known
It allows the compiler to optimize the bytestream2 checks away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 16:30:19 +02:00
Michael Niedermayer
1ad4782d2a avcodec/siren: Improve the bits left threshold in decode_envelope()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-29 19:52:10 +02:00
Michael Niedermayer
109113b54f avcodec/siren: Check available bits in decode_envelope()
Fixes: Timeout
Fixes: 39089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-6677219854909440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-29 19:52:10 +02:00
Andreas Rheinhardt
d619e82e97 avcodec/zmbvenc: Remove redundant pixel format check
ff_encode_preinit() already checked the pixel format via
AVCodec.pix_fmts.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-29 17:02:03 +02:00
Limin Wang
c5f3143090 avcodec/libsvtav1: properly enforce CQP mode when set in wrapper
SVT-AV1 seems to have switched their default from CQP to CRF in February,
so enforce the controlling option accordingly.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:01:16 +08:00
Limin Wang
e99be1735a avcodec: remove the unused low_delay
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-29 18:00:13 +08:00
Peter Ross
855014ff83 avcodec/siren: add checksum calculation
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Peter Ross <pross@xvid.org>
2021-09-28 21:23:26 +10:00
Peter Ross
e40593c050 avcodec/siren: don't reduce getbitcontext size by checksum_bits at initialisation
this allows the checksum calculation routine to also use getbitcontext

Signed-off-by: Peter Ross <pross@xvid.org>
2021-09-28 21:23:26 +10:00
Peter Ross
b007e8968f avcodec/siren: prevent getbitcontext overread
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Peter Ross <pross@xvid.org>
2021-09-28 21:23:26 +10:00
Andreas Rheinhardt
ed6549887a avcodec/encoders: Remove redundant setting of AV_PKT_FLAG_KEY
It is now set generically for all those encoders whose corresponding
AVCodecDescriptor has the AV_CODEC_PROP_INTRA_ONLY.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-28 01:57:10 +02:00
Andreas Rheinhardt
3f11eac757 avcodec/encode: Set AV_PKT_FLAG_KEY based upon AV_CODEC_PROP_INTRA_ONLY
Currently, the AV_PKT_FLAG_KEY is automatically set for audio encoders;
yet this is wrong, as both MLP and TrueHD have non-keyframes. So set it
based upon AV_CODEC_PROP_INTRA_ONLY (from the corresponding
AVCodecDescriptor) instead. This also sets it for some video codecs,
which is intended.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-28 01:56:32 +02:00
Andreas Rheinhardt
f09fd1c6c7 avcodec/codec_desc: Mark MLP as not being intra-only
It has sync frames.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-28 01:55:40 +02:00
Andreas Rheinhardt
db25180e9d avcodec/mlpenc: Set AV_PKT_FLAG_KEY manually
TrueHD/MLP is one of the audio formats with keyframes. Currently,
the generic encoding code just sets the keyframe flag for all
returned packets, yet this is wrong for these encoders and will
be changed in a future commit. So set the flag here for those
packets that ought to have it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-28 01:53:11 +02:00
NoHalfBits
b786bc7433 avcodec/videotoolboxenc: Fixes non-B-Frame encoding
Sets vtctx->has_b_frames to 0 if the VideoToolbox compression
session will not emit B-frames (and, in consequence, no valid
DTSs). Required for the handling of invalid DTSs in
'vtenc_cm_to_avpacket' (line 2018ff) to work correctly and not
abort encoding with "DTS is invalid." when no B-frames are
generated.

Signed-off-by: NoHalfBits <ffmpeg-devel@fluthaus.com>
Signed-off-by: Rick Kern <kernrj@gmail.com>
2021-09-27 07:06:06 -04:00
Michael Niedermayer
0e45886e6e avcodec/apedec: Fix integer overflow in filter_fast_3320()
Fixes: signed integer overflow: 2145649668 + 3956526 cannot be represented in type 'int'
Fixes: 38351/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4647077926273024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:42 +02:00
Michael Niedermayer
20afd3a63a avcodec/mxpegdec: Check for AVDISCARD_ALL
Fixes: Fixes NULL pointer dereference
Fixes: 36610/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-6052641783283712
Fixes: 37907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-4725170850365440
Fixes: 37904/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-6367889262247936
Fixes: 38085/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-5175270823297024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:22:08 +02:00
Michael Niedermayer
991b3deea9 avcodec/h274: fix bad left shifts
Fixes: left shift of negative value -3
Fixes: 37788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6024714540154880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:59 +02:00
Michael Niedermayer
5f835efbca avcodec/flicvideo: Check remaining bytes in FLI*COPY
Fixes: Timeout
Fixes: 37795/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-4846536543043584

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:55 +02:00
Michael Niedermayer
018b611b4b avcodec/utils: ARGO writes 4x4 blocks without regard to the image dimensions
Fixes: out of array access
Fixes: 37197/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-5877046382297088

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-09-26 17:21:40 +02:00
Andreas Rheinhardt
78ec2f3bd7 avcodec/internal: Update AVCodecInternal.is_copy documentation
Forgotten in 1f4cf92cfb.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
b9fd9bce73 avcodec/avcodec: Simplify check for flushing of bsf
Just check for the existence of the bsf. This is equivalent to
the old criterion of the AVCodecContext being a decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
29e23ac71d avcodec/avcodec: Remove redundant assert
It is now checked by FATE that no encoder capable of flushing
uses frame threads, so this now redundant runtime check can
be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:29 +02:00
Andreas Rheinhardt
d6176eeeec avcodec/tests/avcodec: Check codec caps for consistency
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:19 +02:00
Andreas Rheinhardt
482850992c avcodec/avcodec: Make sanity check stricter
If an AVCodec has a private class, its priv_data_size must be > 0
and at the end of a successful call to avcodec_open2()
the AVCodecContext's priv_data must exist and its first element
must be a pointer to said AVClass. This should not be conditional
on priv_data_size being > 0 (which is tested by FATE) or
on the private context having been successfully allocated
(which has to have happened at that point). So remove these
preconditions to make the test stricter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:19 +02:00
Andreas Rheinhardt
2b0f29507f avcodec/tests/avcodec: Sanity check AVCodec.priv_data_size
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-26 13:29:18 +02:00