Compare commits

...

104 Commits

Author SHA1 Message Date
James Almer 84357c09ef avcodec/x86/pngdsp: add missing emms at the end of add_png_paeth_prediction
Fixes unpredictable behavior with floats.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 57a29f2e7d)
2025-09-15 23:48:56 -03:00
Michael Niedermayer e98a6be89b Update for 4.2.11
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:01:16 +02:00
Michael Niedermayer 9ae2d3646b avcodec/takdec: Check remaining space for first predictors
Fixes: Timeout
Fixes: 403673829/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5498240154009600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8e6db875af)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:02 +02:00
Michael Niedermayer abd06f81c8 avcodec/sonic: Check num_taps
The encoder uses max 128 taps, which is quiet a lot already
If work is done to improve sonic, it will be more radical than changing the taps

Fixes: Timeout
Fixes: 402539974/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6122944271286272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd0a792766)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:01 +02:00
Michael Niedermayer 329cd64a24 avformat/mov: reject negative ELST durations
Fixes: multiple integer overflows
Fixes: 401016767/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6242067591790592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9fc2702f6f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:01 +02:00
Michael Niedermayer c52f0d2e0f avcodec/h264_mb: Fix tmp_cr for arm
When decoding a bitstream with weighted-bipred enabled,
the results on ARM and x86 platforms may differ.

The reason for the inconsistency is that the value of
STRIDE_ALIGN differs between platforms. And STRIDE_ALIGN
is set to the buffer stride of temporary buffers for U
and V components in mc_part_weighted.

If the buffer stride is 32 or 64 (as on x86 platforms),
the U and V pixels can be interleaved row by row without
overlapping, resulting in correct output.
However, on ARM platforms where the stride is 16,
the V component did overwrite part of the U component's pixels,
leading to incorrect predicted pixels.

The bug can be reproduced by the following bitstream.

https://trac.ffmpeg.org/attachment/ticket/11357/inter_weighted_bipred2.264

Fixes: ticket 11357
Commit-msg-mostly-by: Bin Peng <pengbin@visionular.com>
Reviewed-by: Bin Peng <pengbin@visionular.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 74fd2c3ddb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:01 +02:00
Michael Niedermayer fef450f3c5 avcodec/vorbisdec: Dont treat overread as error
This differs from libvorbis by
stddev:    2.44 PSNR: 88.58 MAXDIFF:   41 bytes:   834304/   834304
for the file from the ticket

Fixes: Ticket11427

Regression since: dc89cf804a

This is a similar solution to what james proposed earlier in
[FFmpeg-devel] [PATCH] avcodec/vorbisdec: don't abort on EOD when decoding residuals

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd5a3c5fed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:00 +02:00
Michael Niedermayer d553897a10 libpostproc: check minimum size
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 917c15435a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:00 +02:00
Michael Niedermayer 47d7bd31a9 avformat/hls: add fmp4 to allowed_extensions
Fixes: yt-dlp/issues/12700

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d82016c730)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 19:00:00 +02:00
Michael Niedermayer b5657755b5 avformat/hls: Add ec3 to allowed_extensions
Fixes part of Ticket11435
Fixes: Elisa Viihde (Finnish online recording service)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 68644994fd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:59 +02:00
Michael Niedermayer 9dd7ab049f avformat/hls: Add cmfv and cmfa to allowed_extensions
Fixes: www.nicovideo.jp
Fixes: Ticket11526
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2352145e41)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:59 +02:00
Michael Niedermayer 237e877883 configure: Clearer documentation for "disable-safe-bitstream-reader"
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 979608dde7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:59 +02:00
Michael Niedermayer b3f9eac35a swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
Fixes: signed integer overflow: 1966895953 + 210305024 cannot be represented in type 'int'
Fixes: 391921975/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5916798905548800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ce538ef97a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:58 +02:00
James Almer eb88a2318e avcodec/libtheora: fix setting keyframe_mask
t_info.keyframe_granule_shift is set to the library default of 6, which is ok
for gop sizes up to 63. Since there's apparently no way to query the updated
value after having forced a gop value with TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE,
calculate it manually instead.

Fixes ticket #11454.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 22aa71d4da)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:58 +02:00
James Almer 20dee7be59 avfilter/buffersrc: check for valid sample rate
A sample rate <= 0 is invalid.

Fixes an assert in ffmpeg_enc.c that assumed a valid sample rate would be set.
Fixes ticket #11385.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1446e37d3d)
2025-05-16 18:59:57 +02:00
Michael Niedermayer 3c34ce7cfe doc: replace http/git by https urls
These are more secure

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b4d165c68f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:57 +02:00
Lynne 4b61be93b8 configure: update copyright year
On 01/01/2025 19:05, Peter Ross wrote:
> FFmpeg turns 25 this year.

(cherry picked from commit d3aa99a4f4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:57 +02:00
Cosmin Stejerean de0ec0d3af avfilter/bwdif: account for chroma sub-sampling in min size calculation
The current logic for detecting frames that are too small for the
algorithm does not account for chroma sub-sampling, and so a sample
where the luma plane is large enough, but the chroma planes are not
will not be rejected. In that event, a heap overflow will occur.

This change adjusts the logic to consider the chroma planes and makes
the change to all three bwdif implementations.

Fixes #10688

Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Philip Langdale <philipl@overt.org>
(cherry picked from commit 737ede405b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:56 +02:00
Michael Niedermayer 1e0f85a54d avformat/iff: Check that we have a stream in read_dst_frame()
Fixes: null pointer dereference
Fixes: 385644864/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4551049565765632

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>
(cherry picked from commit 8668957ef6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:56 +02:00
Michael Niedermayer b847a91cd0 avformat/mlvdec: fix size checks
Fixes: heap-buffer-overflow
Fixes: 391962476/clusterfuzz-testcase-minimized-ffmpeg_dem_MLV_fuzzer-5746746587676672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 251d43aef0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:56 +02:00
Michael Niedermayer 2ad73fc12c avformat/mxfdec: Check edit unit for overflow in mxf_set_current_edit_unit()
Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: 392672068/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6232335892152320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8a6ad9eab2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:55 +02:00
Michael Niedermayer 9d5b967325 avcodec/h263dec: Check against previous dimensions instead of coded
Fixes: out of array access
Fixes: crash-a41ef3db699013f669b076f02f36942925f5a98c

Found-by: Kacper Michajlow <kasper93@gmail.com>
Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0fe33c99a2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:55 +02:00
Michael Niedermayer 6b4205c95e avformat/mxfdec: Check avio_read() success in mxf_decrypt_triplet()
Fixes: Use of uninitialized memory
Fixes: 71444/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5448597561212928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6ecc96f4d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:55 +02:00
Michael Niedermayer c5fac74428 avcodec/huffyuvdec: Initialize whole output for decode_gray_bitstream()
Fixes: use of uninitialized memory
Fixes: 375286238/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-6352546854141952

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ef71552cf9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:54 +02:00
Michael Niedermayer f8fda20ba6 avformat/ipmovie: Check signature_buffer read
Fixes: use of uninitilaized data
Fixes: 385167047/clusterfuzz-testcase-minimized-ffmpeg_dem_IPMOVIE_fuzzer-5941477505564672

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 788abe0d25)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:54 +02:00
Michael Niedermayer abb4a151ef avformat/wtvdec: Initialize buf
ff_parse_mpeg2_descriptor() reads over what is initialized
Fixes: use of uninitialized memory
Fixes: 383825645/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5144130618982400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 17b019c517)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:54 +02:00
Michael Niedermayer e2aac02c48 avcodec/cbs_vp9: Initialize VP9RawSuperframeIndex
Fixes: use-of-uninitialized-value
Fixes: 70907/clusterfuzz-testcase-minimized-ffmpeg_BSF_VP9_METADATA_fuzzer-6339363208757248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e81d410242)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 18:59:46 +02:00
Michael Niedermayer a4c09cf37a avformat/vqf: Check avio_read() in add_metadata()
Fixes: use of uninitialized data
Fixes: 383825642/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5380168801124352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c43dbecbda)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:50 +02:00
Michael Niedermayer e029108cea avformat/dashdec: Check whitelist
Fixes: CVE-2023-6602, V. DASH Playlist SSRF

Found-by: Harvey Phillips of Amazon Element55 (element55)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4c96d6bf75)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:50 +02:00
Michael Niedermayer a6599d5108 avutil/avstring: dont mess with NULL pointers in av_match_list()
Fixes: applying zero offset to null pointer

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c6c54943d1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:49 +02:00
Michael Niedermayer a18b0ddf50 avcodec/mpegvideo_enc: Check FLV1 resolution limits
Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 827c073154)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:49 +02:00
Michael Niedermayer 5a9ca53ac2 avcodec/ffv1enc: Fix handling of 32bit unsigned symbols
This may be needed for floats

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 402824e9e9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:49 +02:00
Michael Niedermayer 977ced3323 avcodec/vc1dec: Clear block_index in vc1_decode_reset()
Fixes: 377965565/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4504434689769472
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 251de1791e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:48 +02:00
Michael Niedermayer eef4ca9a67 avcodec/aacsbr_template: Clear n_q on error
Fixes: index 5 out of bounds for type 'uint8_t [5]'
Fixes: 377748135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5167109774049280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3f029bfb7f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:48 +02:00
Michael Niedermayer d67d0175db swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
Fixes: signed integer overflow: -1082982400 + -1195645138 cannot be represented in type 'int'
Fixes: 376136843/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4791844321427456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 56faee21c1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:48 +02:00
Michael Niedermayer 6b43edeb24 avfilter/af_pan: Fix sscanf() use
Fixes: Memory Data Leak

Found-by: Simcha Kosman <simcha.kosman@cyberark.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b5b6391d64)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:47 +02:00
Michael Niedermayer 12c9288d47 avformat/rmdec: check that buf if completely filled
Fixes: use of uninitialized value
Fixes: 70988/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5298245077630976

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9578c135d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:47 +02:00
Michael Niedermayer 66402ac52e avcodec/hapdec: Clear tex buffer
The code following makes no attempt to initialize all of the buffer

Fixes: use of uninitialized value
Fixes: 70980/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5329909059223552

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7eeeda703b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:47 +02:00
Michael Niedermayer 777a03ebab avformat/mxfdec: Check that key was read sucessfull
Fixes: use of uninitialized value
Fixes: 70932/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4870202133643264

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4c62cbcae2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:46 +02:00
Michael Niedermayer 72c8f46cb0 avformat/rpl: Fix check for negative values
Fixes: signed integer overflow: 10 * -1923267925333400000 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 378891963/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5714338935013376
Found-by: ossfuzz
Reported-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit eab65379bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:46 +02:00
Michael Niedermayer 50456eb8d4 avformat/mlvdec: Check avio_read()
Fixes: use-of-uninitialized-value
Fixes: 383170476/clusterfuzz-testcase-minimized-ffmpeg_dem_MLV_fuzzer-4696002884337664

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>
(cherry picked from commit bb85423142)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:45 +02:00
Michael Niedermayer d53cf41505 avcodec/utils: Fix block align overflow for ADPCM_IMA_WAV
Fixes: signed integer overflow: 529008646 * 8 cannot be represented in type 'int'
Fixes: 383379145/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6674045107503104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9327093079)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:45 +02:00
Michael Niedermayer 50f46db70d avformat/matroskadec: Check pre_ns for overflow
Fixes: signed integer overflow: -3483479120376300096 - 7442323944145700864 cannot be represented in type 'long'
Fixes: 383187489/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4561470580391936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 361d24e6d9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:45 +02:00
Michael Niedermayer c8fbdc5c6f avcodec/webp: Check ref_x/y
Fixes: 70991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5544067620995072
Fixes: use of uninintailized value

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7c1e732ad2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:44 +02:00
Michael Niedermayer 9df3db27d5 avcodec/ilbcdec: Initialize tempbuff2
Fixes: Use of uninitialized value
Fixes: 71350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-6322020827070464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4482218440)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:44 +02:00
Michael Niedermayer ce9505775a avformat/dxa: check bpc
Fixes: integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 373971762/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-4880491112103936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7e020f2141)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:44 +02:00
Michael Niedermayer 201f2c5912 swscale/slice: clear allocated memory in alloc_lines()
Fixes: use of uninitialized memory in hScale16To15_c()
Fixes: 373924007/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5841199968092160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit aeec39f3c1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:43 +02:00
Michael Niedermayer f7dda674af avformat/icodec: fix integer overflow with nb_pal
Fixes: runtime error: signed integer overflow
Fixes: 42536949/clusterfuzz-testcase-minimized-fuzzer_loadfile-6199846684393472
Found-by: ossfuzz
Reported-by: Kacper Michajlow
Tested-by: Kacper Michajlow
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 84569b6c22)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:43 +02:00
Michael Niedermayer 6a638d42cc doc/developer: Document relationship between git accounts and MAINTAINERS
This should have been documented long ago and i thought it was

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7051825b01)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:43 +02:00
Michael Niedermayer f9eaf66e26 avformat/vividas: Check avio_read() for failure
Fixes: use of uninitialized value (untested)
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5505802505355264

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 96d45c3b21)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:42 +02:00
Michael Niedermayer 3dec911f86 avformat/ilbc: Check avio_read() for failure
Fixes: use of uninitialized value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6656646223298560-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e30d957a9b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:42 +02:00
Michael Niedermayer 5d945a7243 avformat/nistspheredec: Clear buffer
Fixes: use-of-uninitialized-value
Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6515855798632448-cut

Found-by: ossfuzz
Reported-by: Kacper Michajlow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 898f6582eb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:42 +02:00
Michael Niedermayer a59f0a1ad2 INSTALL: explain the circular dependency issue and solution
Sponsored-by: Sovereign Tech Fund
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit df00705e00)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:41 +02:00
Michael Niedermayer 9b48ac2f85 avformat/mpegts: Initialize predefined_SLConfigDescriptor_seen
Fixes: use of uninitialized variable
Fixes: 368729566/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-6044501804646400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit db7b4fc89f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:41 +02:00
Michael Niedermayer da697059f4 avformat/mxfdec: Fix overflow in midpoint computation
Fixes: signed integer overflow: 4611686016549392399 + 9223372033098784800 cannot be represented in type 'long long'
Fixes: 368503277/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5928227458056192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 23088a5ff2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:41 +02:00
Michael Niedermayer f2e8fbb7ff avcodec/rangecoder: only perform renorm check/loop for callers that need it
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d147b3d7ec)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:40 +02:00
Michael Niedermayer bcee885d18 avcodec/ffv1dec: Fix end computation with ec=2
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 10e5af15bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:40 +02:00
Michael Niedermayer c093968c9b avcodec/ffv1enc: Prevent generation of files with broken slices
Fixes: Ticket5548

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b7ff66a358)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:40 +02:00
Michael Niedermayer e0c3272988 avformat/matroskadec: Check desc_bytes so bits fit in 64bit
Likely a tighter check can be done

Fixes: signed integer overflow: 3305606804154370442 * 8 cannot be represented in type 'long'
Fixes: 70449/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4771166007918592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c4122406f6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:39 +02:00
Michael Niedermayer f60e83c0d8 avcodec/ffv1enc: Correct error message about unsupported version
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 556c767786)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:39 +02:00
Michael Niedermayer 70d61dcf2d avcodec/ffv1enc: Slice combination is unsupported
We always write minimal slices, the size calculation is wrong in some
corner cases but as its always 1x1 (minus1) we can for now just hard-code it

This helps with ticket 5548

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7d514655bf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:39 +02:00
Michael Niedermayer 6a5fa843b2 avcodec/ffv1enc: 2Pass mode is not possible with golomb coding
"Fixes" Ticket7063

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 417b163c00)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:38 +02:00
Michael Niedermayer 9768c6e27d avcodec/ffv1enc: Fix >8bit context size
Fixes: Ticket5405

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a9c83e43f2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:38 +02:00
Michael Niedermayer 27a484de3a avcodec/xan: Add basic input size check
Fixes: Timeout
Fixes: 71739/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XAN_WC3_fuzzer-6170301405134848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 56bef2fd58)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:38 +02:00
Michael Niedermayer a07629c6f5 avcodec/svq3: Check for minimum size input
Fixes: Timeout
Fixes: 71295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-4999941125111808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 050b5e85cb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:37 +02:00
Michael Niedermayer fdc673fada avcodec/eacmv: Check input size for intra frames
Fixes: Timeout
Fixes: 71135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EACMV_fuzzer-6251879028293632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c3a1cbbf5d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:37 +02:00
Michael Niedermayer 252222c48f avcodec/jfdctint_template: use unsigned z* in row_fdct()
Fixes: signed integer overflow: 856827136 + 2123580416 cannot be represented in type 'int'
Fixes: 70772/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_KS_fuzzer-5180569961431040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f27c8b04d3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:37 +02:00
Michael Niedermayer e0a47550e9 avformat/mxfdec: More offset_temp checks
Fixes: signed integer overflow: 9223372036854775807 - -1927491430256034080 cannot be represented in type 'long'
Fixes: 70607/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5282235077951488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5a96aa435a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:36 +02:00
Michael Niedermayer de74e8ee6f swscale/output: Fix undefined integer overflow in yuv2rgba64_2_c_template()
Fixes: signed integer overflow: -1082982400 + -1083218484 cannot be represented in type 'int'
Fixes: 70657/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6707819712675840

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bd80c97391)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:36 +02:00
Michael Niedermayer b24fff0e60 swscale/swscale: Use unsigned operation to avoid undefined behavior
I have not checked that the constant is correct, this just fixes the undefined behavior

Fixes: signed integer overflow: -646656 * 3517 cannot be represented in type 'int
Fixes: 70559/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5209368631508992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 44c5641ae8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:36 +02:00
Michael Niedermayer 0b22eccc7c avcodec/vc2enc: basic sanity check on slice_max_bytes
Fixes: left shift of 896021632 by 3 places cannot be represented in type 'int'
Fixes: 70544/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC2_fuzzer-6685593652756480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6df9a0292c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:35 +02:00
Michael Niedermayer e7a715ff2b avformat/mvdec: Check if name was fully read
Fixes: use of uninitialized value
Fixes: 70901/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-6341913949569024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4e39795c75)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:35 +02:00
Michael Niedermayer be4a8ea47d avcodec/wmavoice: Do not use uninitialized pitch[0]
Fixes: use of uninitialized value
Fixes: 70850/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-4806127362048000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5338707930)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:35 +02:00
Michael Niedermayer f6c823fab0 avformat/apetag: Check APETAGEX
Fixes: Use of uninitialized value
Fixes: 71074/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5697034877730816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 796ff2d599)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:34 +02:00
Michael Niedermayer c351f8d61e avcodec/avcodec: Warn about data returned from get_buffer*()
Text based on suggestion by: epirat07@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 93444c46fce195e378c4ebb1a20ea662e7f0123b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:34 +02:00
Michael Niedermayer e9e2c60742 avcodec/aic: Clear slice_data
Fixes: use-of-uninitialized-value
Fixes: 70865/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AIC_fuzzer-4874102695854080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit de3f6c8888)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:34 +02:00
Michael Niedermayer 56a46d084d avcodec/vc1dec: Clear mb_type_base and ttblk_base
Fixes: two use-of-uninitialized-value
Fixes: 70856/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5539349918187520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 50471f96c4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:33 +02:00
Michael Niedermayer 3c434e3137 avcodec/shorten: clear padding
Fixes: use-of-uninitialized-value
Fixes: 70854/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5533480570650624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e44349ee88)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:33 +02:00
Michael Niedermayer fc9f06b284 avformat/mpeg: Check an avio_read() for failure
Fixes: use-of-uninitialized-value
Fixes: 70849/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGPS_fuzzer-4684401009557504

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 66ee75d76c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:33 +02:00
Michael Niedermayer 1594615ff7 avformat/segafilm: Set keyframe
Fixes: use of uninitialized value
Fixes: 70871/clusterfuzz-testcase-minimized-ffmpeg_dem_SEGAFILM_fuzzer-5883617752973312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4dc7dfe65a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:32 +02:00
Michael Niedermayer b1d497354a avcodec/dxva2: initialize hr in ff_dxva2_common_end_frame()
Related: CID1591924 Uninitialized scalar variable
Related: CID1591938 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1d6a2aebae)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:32 +02:00
Michael Niedermayer c86e9cde18 avcodec/dxva2: initialize validate
Related: CID1591915 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2232c4cc8c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:31 +02:00
Michael Niedermayer a3254fd687 avcodec/dxva2: Initialize ConfigBitstreamRaw
Related: CID1591894 Uninitialized scalar variable
Related: CID1591906 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 489c05b9c3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:31 +02:00
Michael Niedermayer ca55217925 avcodec/dxva2: Initialize dxva_size and check it
Related: CID1591878 Uninitialized scalar variable
Related: CID1591928 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c8c59e9929)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:31 +02:00
Michael Niedermayer 92625e05fe avfilter/vf_tonemap_opencl: Dereference after NULL check
Fixes: CID1437472 Dereference before null check

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e5c0f56ca0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:30 +02:00
Michael Niedermayer f19fa10643 avformat/lmlm4: Eliminate some AVERROR(EIO)
Found by code review related to CID732224 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 191a685010)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:30 +02:00
Michael Niedermayer f09b8df1d0 avformat/wtvdec: Check length of read mpeg2_descriptor
Fixes: Use of uninitialized value
Fixes: 70900/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6286909377150976

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>
(cherry picked from commit c390234da2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:30 +02:00
Michael Niedermayer 07b577e6ee avformat/wtvdec: clear sectors
The code can leave uninitialized holes in the array.
Fixes: use of uninitialized values
Fixes: 70883/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6698694567591936

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>
(cherry picked from commit c95ea03104)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:29 +02:00
Kacper Michajłow 607d002a9d avcodec/parser: ensure input padding is zeroed
Fixes use of uninitialized value, reported by MSAN.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

Fixes: 70852/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5179190066872320
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5dfc0cc841)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:29 +02:00
Michael Niedermayer e9cf7a8c81 avformat/img2dec: Clear padding data after EOF
Fixes: use-of-uninitialized-value
Fixes: 70852/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5179190066872320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3978e81809)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:29 +02:00
Michael Niedermayer 4ac3fa04a5 avformat/wavdec: Check if there are 16 bytes before testing them
Fixes: use-of-uninitialized-value
Fixes: 70839/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5212907590189056

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 79a1cf30d1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-16 03:03:28 +02:00
Janne Grunau 655b6f8877 vp9: recon: Use emulated edge to prevent buffer overflows
The arm/aarch64 horizontal filter reads one additional pixel beyond what
the filter uses. This can become an issue if the application does not
allocate larger buffers than what's required for the pixel data. If the
motion vector points to the bottom right edge of the picture this
becomes a read buffer overflow. This triggers segfaults in Firefox for
video resolutions which result in a page aligned picture size like
1280x640.
Prevent this by using emulated edge in this case.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 060464105b)
2025-01-04 07:31:07 -05:00
Janne Grunau a342536d6b arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
This mirrors the aarch64 change.

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit f366256215)
2025-01-04 07:31:07 -05:00
Janne Grunau bfed437be8 aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
Under these conditions like seen by Firefox a read beyond the end of the
buffer results in a segfault.
After the over-read is reduced to a single pixel it's reasonable to use
VP9's emulated edge motion compensation for this.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 430c38f698)
2025-01-04 07:31:07 -05:00
Ramiro Polla 54034aa338 configure: improve check for POSIX ioctl
Instead of relying on system #ifdefs which may or may not be correct,
detect the POSIX ioctl signature at configure time.

(cherry picked from commit 00b64fca55)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 21:07:24 -04:00
Ramiro Polla 13f5d6eba5 configure: restore autodetection of v4l2 and fbdev
The detection logic for v4l2 and fbdev was accidentally modified to
depend on v4l2-m2m in 43b3412.

(cherry picked from commit 7405f1ad53)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 21:06:40 -04:00
Jun Zhao 6247037d6c configure: fix --disable-v4l2-m2m can't work
Use the command ./configure with/without --disable-v4l2-m2m test.

Reviewed-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
(cherry picked from commit 43b3412631)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 21:05:24 -04:00
Brad Smith 98968e2a1b configure: use just the pkg-config for sndio
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f6d8464590)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:33:33 -04:00
Brad Smith 25d75ff1f5 configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 43b1a95678)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:32:22 -04:00
Brad Smith 6d9e2e94c3 avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
Use the machdep.altivec sysctl on NetBSD for AltiVec detection
as is done with OpenBSD.

(cherry picked from commit 115c96b9bd)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:31:51 -04:00
Brad Smith 3eb8705ab7 avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
Use the proper header for PPC CPU detection code. sys/param.h includes
sys/types, but sys/types.h is the more appropriate header to be used
here.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit beaf172d75)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:29:54 -04:00
Brad Smith 084c75f664 lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
The proper type was used until 73251678c8.

This covers all of the OS's that currently have V4L2 support, permutations
of Linux glibc/musl, Android bionic, FreeBSD, NetBSD, OpenBSD, Solaris.

Copied from FreeBSD ports patch.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 9e674b3160)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:28:45 -04:00
Brad Smith 5fb8f0e850 configure: use pkg-config for sndio
(cherry picked from commit bb813ccb45)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-09-01 20:27:57 -04:00
Ross Burton 05e413bfb2 libavcodec/arm/mlpdsp_armv5te: fix label format to work with binutils 2.43
binutils 2.43 has stricter validation for labels[1] and results in errors
when building ffmpeg for armv5:

src/libavcodec/arm/mlpdsp_armv5te.S:232: Error: junk at end of line, first unrecognized character is `0'

Remove the leading zero in the "01" label to resolve this error.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 654bd47716)
2024-08-16 13:49:45 +03:00
80 changed files with 418 additions and 135 deletions
+104
View File
@@ -1,6 +1,110 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 4.2.11:
avcodec/takdec: Check remaining space for first predictors
avcodec/sonic: Check num_taps
avformat/mov: reject negative ELST durations
avcodec/h264_mb: Fix tmp_cr for arm
avcodec/vorbisdec: Dont treat overread as error
libpostproc: check minimum size
avformat/hls: add fmp4 to allowed_extensions
avformat/hls: Add ec3 to allowed_extensions
avformat/hls: Add cmfv and cmfa to allowed_extensions
configure: Clearer documentation for "disable-safe-bitstream-reader"
swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
avcodec/libtheora: fix setting keyframe_mask
avfilter/buffersrc: check for valid sample rate
doc: replace http/git by https urls
configure: update copyright year
avfilter/bwdif: account for chroma sub-sampling in min size calculation
avformat/iff: Check that we have a stream in read_dst_frame()
avformat/mlvdec: fix size checks
avformat/mxfdec: Check edit unit for overflow in mxf_set_current_edit_unit()
avcodec/h263dec: Check against previous dimensions instead of coded
avformat/mxfdec: Check avio_read() success in mxf_decrypt_triplet()
avcodec/huffyuvdec: Initialize whole output for decode_gray_bitstream()
avformat/ipmovie: Check signature_buffer read
avformat/wtvdec: Initialize buf
avcodec/cbs_vp9: Initialize VP9RawSuperframeIndex
avformat/vqf: Check avio_read() in add_metadata()
avformat/dashdec: Check whitelist
avutil/avstring: dont mess with NULL pointers in av_match_list()
avcodec/mpegvideo_enc: Check FLV1 resolution limits
avcodec/ffv1enc: Fix handling of 32bit unsigned symbols
avcodec/vc1dec: Clear block_index in vc1_decode_reset()
avcodec/aacsbr_template: Clear n_q on error
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
avfilter/af_pan: Fix sscanf() use
avformat/rmdec: check that buf if completely filled
avcodec/hapdec: Clear tex buffer
avformat/mxfdec: Check that key was read sucessfull
avformat/rpl: Fix check for negative values
avformat/mlvdec: Check avio_read()
avcodec/utils: Fix block align overflow for ADPCM_IMA_WAV
avformat/matroskadec: Check pre_ns for overflow
avcodec/webp: Check ref_x/y
avcodec/ilbcdec: Initialize tempbuff2
avformat/dxa: check bpc
swscale/slice: clear allocated memory in alloc_lines()
avformat/icodec: fix integer overflow with nb_pal
doc/developer: Document relationship between git accounts and MAINTAINERS
avformat/vividas: Check avio_read() for failure
avformat/ilbc: Check avio_read() for failure
avformat/nistspheredec: Clear buffer
INSTALL: explain the circular dependency issue and solution
avformat/mpegts: Initialize predefined_SLConfigDescriptor_seen
avformat/mxfdec: Fix overflow in midpoint computation
avcodec/rangecoder: only perform renorm check/loop for callers that need it
avcodec/ffv1dec: Fix end computation with ec=2
avcodec/ffv1enc: Prevent generation of files with broken slices
avformat/matroskadec: Check desc_bytes so bits fit in 64bit
avcodec/ffv1enc: Correct error message about unsupported version
avcodec/ffv1enc: Slice combination is unsupported
avcodec/ffv1enc: 2Pass mode is not possible with golomb coding
avcodec/ffv1enc: Fix >8bit context size
avcodec/xan: Add basic input size check
avcodec/svq3: Check for minimum size input
avcodec/eacmv: Check input size for intra frames
avcodec/jfdctint_template: use unsigned z* in row_fdct()
avformat/mxfdec: More offset_temp checks
swscale/output: Fix undefined integer overflow in yuv2rgba64_2_c_template()
swscale/swscale: Use unsigned operation to avoid undefined behavior
avcodec/vc2enc: basic sanity check on slice_max_bytes
avformat/mvdec: Check if name was fully read
avcodec/wmavoice: Do not use uninitialized pitch[0]
avformat/apetag: Check APETAGEX
avcodec/avcodec: Warn about data returned from get_buffer*()
avcodec/aic: Clear slice_data
avcodec/vc1dec: Clear mb_type_base and ttblk_base
avcodec/shorten: clear padding
avformat/mpeg: Check an avio_read() for failure
avformat/segafilm: Set keyframe
avcodec/dxva2: initialize hr in ff_dxva2_common_end_frame()
avcodec/dxva2: initialize validate
avcodec/dxva2: Initialize ConfigBitstreamRaw
avcodec/dxva2: Initialize dxva_size and check it
avfilter/vf_tonemap_opencl: Dereference after NULL check
avformat/lmlm4: Eliminate some AVERROR(EIO)
avformat/wtvdec: Check length of read mpeg2_descriptor
avformat/wtvdec: clear sectors
avcodec/parser: ensure input padding is zeroed
avformat/img2dec: Clear padding data after EOF
avformat/wavdec: Check if there are 16 bytes before testing them
vp9: recon: Use emulated edge to prevent buffer overflows
arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
configure: improve check for POSIX ioctl
configure: restore autodetection of v4l2 and fbdev
configure: fix --disable-v4l2-m2m can't work
configure: use just the pkg-config for sndio
configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection
lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
configure: use pkg-config for sndio
libavcodec/arm/mlpdsp_armv5te: fix label format to work with binutils 2.43
version 4.2.10:
avcodec/snow: Fix off by 1 error in run_buffer
+8
View File
@@ -15,3 +15,11 @@ NOTICE
------
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
NOTICE for Package Maintainers
------------------------------
- It is recommended to build FFmpeg twice, first with minimal external dependencies so
that 3rd party packages, which depend on FFmpegs libavutil/libavfilter/libavcodec/libavformat
can then be built. And last build FFmpeg with full dependancies (which may in turn depend on
some of these 3rd party packages). This avoids circular dependencies during build.
+1 -1
View File
@@ -1 +1 @@
4.2.10
4.2.11
Vendored
+22 -15
View File
@@ -407,7 +407,9 @@ Advanced options (experts only):
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
--disable-safe-bitstream-reader
disable buffer boundary checking in bitreaders
(faster, but may crash)
(This disables some security checks and can cause undefined behavior,
crashes and arbitrary code execution, it may be faster, but
should only be used with trusted input)
--sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
Optimization options (experts only):
@@ -2312,6 +2314,7 @@ HAVE_LIST="
opencl_vaapi_intel_media
perl
pod2man
posix_ioctl
texi2html
"
@@ -6431,20 +6434,24 @@ perl -v > /dev/null 2>&1 && enable perl || disable perl
pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
# check V4L2 codecs available in the API
check_headers linux/fb.h
check_headers linux/videodev2.h
test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
test_code cc sys/ioctl.h "int ioctl(int, int, ...)" && enable posix_ioctl
# check V4L2 codecs available in the API
if enabled v4l2_m2m; then
check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;"
check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;"
check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;"
check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;"
check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;"
check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;"
check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;"
check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;"
check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;"
check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;"
fi
check_headers sys/videoio.h
test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
@@ -6478,7 +6485,7 @@ enabled alsa && check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp
enabled libjack &&
require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
enabled sndio && check_lib sndio sndio.h sio_open -lsndio
enabled sndio && check_pkg_config sndio sndio sndio.h sio_open
if enabled libcdio; then
check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
@@ -6571,7 +6578,7 @@ enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.
if enabled x86; then
case $target_os in
mingw32*|mingw64*|win32|win64|linux|cygwin*)
freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
;;
*)
disable ffnvcodec cuvid nvdec nvenc
@@ -7399,7 +7406,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 2024
#define CONFIG_THIS_YEAR 2025
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 4.2.10
PROJECT_NUMBER = 4.2.11
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+19
View File
@@ -759,6 +759,25 @@ In case you need finer control over how valgrind is invoked, use the
@code{--target-exec='valgrind <your_custom_valgrind_options>} option in
your configure line instead.
@anchor{Maintenance}
@chapter Maintenance process
@anchor{MAINTAINERS}
@section MAINTAINERS
The developers maintaining each part of the codebase are listed in @file{MAINTAINERS}.
Being listed in @file{MAINTAINERS}, gives one the right to have git write access to
the specific repository.
@anchor{Becoming a maintainer}
@section Becoming a maintainer
People add themselves to @file{MAINTAINERS} by sending a patch like any other code
change. These get reviewed by the community like any other patch. It is expected
that, if someone has an objection to a new maintainer, she is willing to object
in public with her full name and is willing to take over maintainership for the area.
@anchor{Release process}
@chapter Release process
+1 -1
View File
@@ -1,5 +1,5 @@
slot= # some unique identifier
repo=git://source.ffmpeg.org/ffmpeg.git # the source repository
repo=https://git.ffmpeg.org/ffmpeg.git # the source repository
#branch=release/2.6 # the branch to test
samples= # path to samples directory
workdir= # directory in which to do all the work
+1 -1
View File
@@ -143,7 +143,7 @@ git log <filename(s)>
@end example
You may also use the graphical tools like @command{gitview} or @command{gitk}
or the web interface available at @url{http://source.ffmpeg.org/}.
or the web interface available at @url{https://git.ffmpeg.org/ffmpeg.git}.
@section Checking source tree status
+1
View File
@@ -592,6 +592,7 @@ static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
if (sbr->n_q > 5) {
av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
sbr->n_q = 1;
return -1;
}
+9 -1
View File
@@ -260,6 +260,9 @@ function \type\()_8tap_\size\()h_\idx1\idx2
// reduced dst stride
.if \size >= 16
sub x1, x1, x5
.elseif \size == 4
add x12, x2, #8
add x13, x7, #8
.endif
// size >= 16 loads two qwords and increments x2,
// for size 4/8 it's enough with one qword and no
@@ -278,9 +281,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
.if \size >= 16
ld1 {v4.8b, v5.8b, v6.8b}, [x2], #24
ld1 {v16.8b, v17.8b, v18.8b}, [x7], #24
.else
.elseif \size == 8
ld1 {v4.8b, v5.8b}, [x2]
ld1 {v16.8b, v17.8b}, [x7]
.else // \size == 4
ld1 {v4.8b}, [x2]
ld1 {v16.8b}, [x7]
ld1 {v5.s}[0], [x12], x3
ld1 {v17.s}[0], [x13], x3
.endif
uxtl v4.8h, v4.8b
uxtl v5.8h, v5.8b
+1 -2
View File
@@ -470,8 +470,7 @@ static av_cold int aic_decode_init(AVCodecContext *avctx)
}
}
ctx->slice_data = av_malloc_array(ctx->slice_width, AIC_BAND_COEFFS
* sizeof(*ctx->slice_data));
ctx->slice_data = av_calloc(ctx->slice_width, AIC_BAND_COEFFS * sizeof(*ctx->slice_data));
if (!ctx->slice_data) {
av_log(avctx, AV_LOG_ERROR, "Error allocating slice buffer\n");
+3 -3
View File
@@ -229,7 +229,7 @@ A .endif
.endif
// Begin loop
01:
1:
.if TOTAL_TAPS == 0
// Things simplify a lot in this case
// In fact this could be pipelined further if it's worth it...
@@ -241,7 +241,7 @@ A .endif
str ST0, [PST, #-4]!
str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
str ST0, [PSAMP], #4 * MAX_CHANNELS
bne 01b
bne 1b
.else
.if \fir_taps & 1
.set LOAD_REG, 1
@@ -333,7 +333,7 @@ T orr AC0, AC0, AC1
str ST3, [PST, #-4]!
str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
str ST3, [PSAMP], #4 * MAX_CHANNELS
bne 01b
bne 1b
.endif
b 99f
+10 -3
View File
@@ -279,11 +279,13 @@ function \type\()_8tap_\size\()h_\idx1\idx2
sub r1, r1, r5
.endif
@ size >= 16 loads two qwords and increments r2,
@ for size 4/8 it's enough with one qword and no
@ postincrement
@ size 4 loads 1 d word, increments r2 and loads 1 32-bit lane
@ for size 8 it's enough with one qword and no postincrement
.if \size >= 16
sub r3, r3, r5
sub r3, r3, #8
.elseif \size == 4
sub r3, r3, #8
.endif
@ Load the filter vector
vld1.16 {q0}, [r12,:128]
@@ -295,9 +297,14 @@ function \type\()_8tap_\size\()h_\idx1\idx2
.if \size >= 16
vld1.8 {d18, d19, d20}, [r2]!
vld1.8 {d24, d25, d26}, [r7]!
.else
.elseif \size == 8
vld1.8 {q9}, [r2]
vld1.8 {q12}, [r7]
.else @ size == 4
vld1.8 {d18}, [r2]!
vld1.8 {d24}, [r7]!
vld1.32 {d19[0]}, [r2]
vld1.32 {d25[0]}, [r7]
.endif
vmovl.u8 q8, d18
vmovl.u8 q9, d19
+4
View File
@@ -2333,6 +2333,10 @@ typedef struct AVCodecContext {
* this callback and filled with the extra buffers if there are more
* buffers than buf[] can hold. extended_buf will be freed in
* av_frame_unref().
* Decoders will generally initialize the whole buffer before it is output
* but it can in rare error conditions happen that uninitialized data is passed
* through. \important The buffers returned by get_buffer* should thus not contain sensitive
* data.
*
* If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
* avcodec_default_get_buffer2() instead of providing buffers allocated by
+1 -1
View File
@@ -423,7 +423,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
superframe_header = frag->data[frag->data_size - 1];
if ((superframe_header & 0xe0) == 0xc0) {
VP9RawSuperframeIndex sfi;
VP9RawSuperframeIndex sfi = {0};
GetBitContext gbc;
size_t index_size, pos;
int i;
+5 -5
View File
@@ -111,7 +111,7 @@ static int dxva_get_decoder_configuration(AVCodecContext *avctx,
for (i = 0; i < cfg_count; i++) {
unsigned score;
UINT ConfigBitstreamRaw;
UINT ConfigBitstreamRaw = 0;
GUID guidConfigBitstreamEncryption;
#if CONFIG_D3D11VA
@@ -262,7 +262,7 @@ static int dxva_get_decoder_guid(AVCodecContext *avctx, void *service, void *sur
*decoder_guid = ff_GUID_NULL;
for (i = 0; dxva_modes[i].guid; i++) {
const dxva_mode *mode = &dxva_modes[i];
int validate;
int validate = 0;
if (!dxva_check_codec_compatibility(avctx, mode))
continue;
@@ -794,7 +794,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
unsigned type, const void *data, unsigned size,
unsigned mb_count)
{
void *dxva_data;
void *dxva_data = NULL;
unsigned dxva_size;
int result;
HRESULT hr = 0;
@@ -816,7 +816,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
type, (unsigned)hr);
return -1;
}
if (size <= dxva_size) {
if (dxva_data && size <= dxva_size) {
memcpy(dxva_data, data, size);
#if CONFIG_D3D11VA
@@ -894,7 +894,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
#endif
DECODER_BUFFER_DESC *buffer = NULL, *buffer_slice = NULL;
int result, runs = 0;
HRESULT hr;
HRESULT hr = -1;
unsigned type;
FFDXVASharedContext *sctx = DXVA_SHARED_CONTEXT(avctx);
+4 -1
View File
@@ -198,12 +198,15 @@ static int cmv_decode_frame(AVCodecContext *avctx,
if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
return ret;
buf += EA_PREAMBLE_SIZE;
if (!(buf[0]&1) && buf_end - buf < s->width * s->height * (int64_t)(100 - s->avctx->discard_damaged_percentage) / 100)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
memcpy(frame->data[1], s->palette, AVPALETTE_SIZE);
buf += EA_PREAMBLE_SIZE;
if ((buf[0]&1)) { // subtype
cmv_decode_inter(s, frame, buf+2, buf_end);
frame->key_frame = 0;
+7
View File
@@ -114,6 +114,13 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
return 0;
}
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift) {
int mpw = 1<<chroma_shift;
int i = width * (int64_t)(num_h_slices - 1) / num_h_slices;
return width % mpw && (width - i) % mpw == 0;
}
av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
{
int i;
+1
View File
@@ -147,6 +147,7 @@ int ff_ffv1_init_slice_contexts(FFV1Context *f);
int ff_ffv1_allocate_initial_states(FFV1Context *f);
void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs);
int ff_ffv1_close(AVCodecContext *avctx);
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift);
static av_always_inline int fold(int diff, int bits)
{
+1 -1
View File
@@ -364,7 +364,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
if (fs->ac != AC_GOLOMB_RICE && f->version > 2) {
int v;
get_rac(&fs->c, (uint8_t[]) { 129 });
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec;
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*!!f->ec;
if (v) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
fs->slice_damaged = 1;
+23 -12
View File
@@ -200,7 +200,7 @@ static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c,
} while (0)
if (v) {
const int a = FFABS(v);
const unsigned a = is_signed ? FFABS(v) : v;
const int e = av_log2(a);
put_rac(c, state + 0, 0);
if (e <= 9) {
@@ -520,6 +520,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->slices > 1)
s->version = FFMAX(s->version, 2);
if ((avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) && s->ac == AC_GOLOMB_RICE) {
av_log(avctx, AV_LOG_ERROR, "2 Pass mode is not possible with golomb coding\n");
return AVERROR(EINVAL);
}
// Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability
if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576)
s->version = FFMAX(s->version, 2);
@@ -544,7 +549,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->version = FFMAX(s->version, 3);
if ((s->version == 2 || s->version>3) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
av_log(avctx, AV_LOG_ERROR, "Version 2 needed for requested features but version 2 is experimental and not enabled\n");
av_log(avctx, AV_LOG_ERROR, "Version 2 or 4 needed for requested features but version 2 or 4 is experimental and not enabled\n");
return AVERROR_INVALIDDATA;
}
@@ -729,19 +734,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->quant_tables[1][2][i]= 11*11*quant5 [i];
s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
} else {
s->quant_tables[0][0][i]= quant9_10bit[i];
s->quant_tables[0][1][i]= 11*quant9_10bit[i];
s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
s->quant_tables[0][1][i]= 9*quant9_10bit[i];
s->quant_tables[0][2][i]= 9*9*quant9_10bit[i];
s->quant_tables[1][0][i]= quant9_10bit[i];
s->quant_tables[1][1][i]= 11*quant9_10bit[i];
s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
s->quant_tables[1][1][i]= 9*quant9_10bit[i];
s->quant_tables[1][2][i]= 9*9*quant5_10bit[i];
s->quant_tables[1][3][i]= 5*9*9*quant5_10bit[i];
s->quant_tables[1][4][i]= 5*5*9*9*quant5_10bit[i];
s->context_count[0] = (9 * 9 * 9 + 1) / 2;
s->context_count[1] = (9 * 9 * 5 * 5 * 5 + 1) / 2;
}
}
s->context_count[0] = (11 * 11 * 11 + 1) / 2;
s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
memcpy(s->quant_table, s->quant_tables[s->context_model],
sizeof(s->quant_table));
@@ -879,6 +886,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
continue;
if (maxw * maxh * (int64_t)(s->bits_per_raw_sample+1) * plane_count > 8<<24)
continue;
if (s->version < 4)
if ( ff_need_new_slices(avctx->width , s->num_h_slices, s->chroma_h_shift)
||ff_need_new_slices(avctx->height, s->num_v_slices, s->chroma_v_shift))
continue;
if (avctx->slices == s->num_h_slices * s->num_v_slices && avctx->slices <= MAX_SLICES || !avctx->slices)
goto slices_ok;
}
@@ -927,8 +938,8 @@ static void encode_slice_header(FFV1Context *f, FFV1Context *fs)
put_symbol(c, state, (fs->slice_x +1)*f->num_h_slices / f->width , 0);
put_symbol(c, state, (fs->slice_y +1)*f->num_v_slices / f->height , 0);
put_symbol(c, state, (fs->slice_width +1)*f->num_h_slices / f->width -1, 0);
put_symbol(c, state, (fs->slice_height+1)*f->num_v_slices / f->height-1, 0);
put_symbol(c, state, 0, 0);
put_symbol(c, state, 0, 0);
for (j=0; j<f->plane_count; j++) {
put_symbol(c, state, f->plane[j].quant_table_index, 0);
av_assert0(f->plane[j].quant_table_index == f->context_model);
+10 -4
View File
@@ -426,7 +426,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
MpegEncContext *s = avctx->priv_data;
int ret;
int slice_ret = 0;
AVFrame *pict = data;
int bak_width, bak_height;
/* no supplementary picture */
if (buf_size == 0) {
@@ -490,6 +492,9 @@ retry:
// we need the idct permutation for reading a custom matrix
ff_mpv_idct_init(s);
bak_width = s->width;
bak_height = s->height;
/* let's go :-) */
if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
ret = ff_wmv2_decode_picture_header(s);
@@ -512,11 +517,12 @@ retry:
}
if (ret < 0 || ret == FRAME_SKIPPED) {
if ( s->width != avctx->coded_width
|| s->height != avctx->coded_height) {
if ( s->width != bak_width
|| s->height != bak_height) {
av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
s->width = avctx->coded_width;
s->height= avctx->coded_height;
s->width = bak_width;
s->height= bak_height;
}
}
if (ret == FRAME_SKIPPED)
+1 -1
View File
@@ -406,7 +406,7 @@ static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceCon
/* don't optimize for luma-only case, since B-frames usually
* use implicit weights => chroma too. */
uint8_t *tmp_cb = sl->bipred_scratchpad;
uint8_t *tmp_cr = sl->bipred_scratchpad + (16 << pixel_shift);
uint8_t *tmp_cr = sl->bipred_scratchpad + (8 << pixel_shift + (chroma_idc == 3));
uint8_t *tmp_y = sl->bipred_scratchpad + 16 * sl->mb_uvlinesize;
int refn0 = sl->ref_cache[0][scan8[n]];
int refn1 = sl->ref_cache[1][scan8[n]];
+1
View File
@@ -372,6 +372,7 @@ static int hap_decode(AVCodecContext *avctx, void *data,
ret = av_reallocp(&ctx->tex_buf, ctx->tex_size);
if (ret < 0)
return ret;
memset(ctx->tex_buf, 0, ctx->tex_size);
avctx->execute2(avctx, decompress_chunks_thread, NULL,
ctx->chunk_results, ctx->chunk_count);
+2
View File
@@ -767,6 +767,8 @@ static void decode_gray_bitstream(HYuvContext *s, int count)
for (i = 0; i < count && BITS_LEFT(re, &s->gb) > 0; i++) {
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
}
for (; i < count; i++)
s->temp[0][2 * i] = s->temp[0][2 * i + 1] = 0;
} else {
for (i = 0; i < count; i++) {
READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
+1 -1
View File
@@ -653,7 +653,7 @@ static void get_codebook(int16_t * cbvec, /* (o) Constructed codebook vector *
int16_t k, base_size;
int16_t lag;
/* Stack based */
int16_t tempbuff2[SUBL + 5];
int16_t tempbuff2[SUBL + 5] = {0};
/* Determine size of codebook sections */
base_size = lMem - cbveclen + 1;
+1 -1
View File
@@ -183,7 +183,7 @@ static av_always_inline void FUNC(row_fdct)(int16_t *data)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5;
unsigned z1, z2, z3, z4, z5;
int16_t *dataptr;
int ctr;
+1 -1
View File
@@ -232,7 +232,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
return AVERROR_EXTERNAL;
}
h->keyframe_mask = (1 << t_info.keyframe_granule_shift) - 1;
h->keyframe_mask = (1 << av_ceil_log2(avc_context->gop_size)) - 1;
/* Clear up theora_info struct */
th_info_clear(&t_info);
+6
View File
@@ -562,6 +562,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(avctx, AV_LOG_ERROR, "H.263 does not support resolutions above 2048x1152\n");
return -1;
}
if (s->codec_id == AV_CODEC_ID_FLV1 &&
(avctx->width > 65535 ||
avctx->height > 65535 )) {
av_log(avctx, AV_LOG_ERROR, "FLV does not support resolutions above 16bit\n");
return AVERROR(EINVAL);
}
if ((s->codec_id == AV_CODEC_ID_H263 ||
s->codec_id == AV_CODEC_ID_H263P) &&
((avctx->width &3) ||
+1
View File
@@ -267,6 +267,7 @@ int ff_combine_frame(ParseContext *pc, int next,
}
pc->buffer = new_buffer;
memcpy(&pc->buffer[pc->index], *buf, *buf_size);
memset(&pc->buffer[pc->index + *buf_size], 0, AV_INPUT_BUFFER_PADDING_SIZE);
pc->index += *buf_size;
return -1;
}
+2 -3
View File
@@ -71,7 +71,6 @@ void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
static inline void renorm_encoder(RangeCoder *c)
{
// FIXME: optimize
while (c->range < 0x100) {
if (c->outstanding_byte < 0) {
c->outstanding_byte = c->low >> 8;
} else if (c->low <= 0xFF00) {
@@ -90,7 +89,6 @@ static inline void renorm_encoder(RangeCoder *c)
c->low = (c->low & 0xFF) << 8;
c->range <<= 8;
}
}
static inline int get_rac_count(RangeCoder *c)
@@ -117,7 +115,8 @@ static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
*state = c->one_state[*state];
}
renorm_encoder(c);
while (c->range < 0x100)
renorm_encoder(c);
}
static inline void refill(RangeCoder *c)
+1
View File
@@ -558,6 +558,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
buf = &s->bitstream[s->bitstream_index];
buf_size += s->bitstream_size;
s->bitstream_size = buf_size;
memset(buf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
/* do not decode until buffer has at least max_framesize bytes or
* the end of the file has been reached */
+3
View File
@@ -927,6 +927,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
if (get_bits1(&gb)) // XXX FIXME
av_log(avctx, AV_LOG_INFO, "Custom quant table\n");
if (s->num_taps > 128)
return AVERROR_INVALIDDATA;
s->block_align = 2048LL*s->samplerate/(44100*s->downsampling);
s->frame_size = s->channels*s->block_align*s->downsampling;
// avctx->frame_size = s->block_align;
+3
View File
@@ -1439,6 +1439,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
if (svq3_decode_slice_header(avctx))
return -1;
if (avpkt->size < s->mb_width * s->mb_height / 8)
return AVERROR_INVALIDDATA;
s->pict_type = s->slice_type;
if (s->pict_type != AV_PICTURE_TYPE_B)
+3
View File
@@ -431,6 +431,9 @@ static int decode_subframe(TAKDecContext *s, int32_t *decoded,
return AVERROR_INVALIDDATA;
}
if (get_bits_left(gb) < 2*10 + 2*size)
return AVERROR_INVALIDDATA;
s->predictors[0] = get_sbits(gb, 10);
s->predictors[1] = get_sbits(gb, 10);
s->predictors[2] = get_sbits(gb, size) * (1 << (10 - size));
+1 -1
View File
@@ -1724,7 +1724,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
case AV_CODEC_ID_ADPCM_IMA_WAV:
if (bps < 2 || bps > 5)
return 0;
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8LL);
break;
case AV_CODEC_ID_ADPCM_IMA_DK3:
tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
+3 -2
View File
@@ -344,7 +344,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
if (!v->block || !v->cbp_base)
goto error;
v->cbp = v->cbp_base + 2 * s->mb_stride;
v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 3 * s->mb_stride);
v->ttblk_base = av_mallocz(sizeof(v->ttblk_base[0]) * 3 * s->mb_stride);
if (!v->ttblk_base)
goto error;
v->ttblk = v->ttblk_base + 2 * s->mb_stride;
@@ -358,7 +358,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
v->luma_mv = v->luma_mv_base + 2 * s->mb_stride;
/* allocate block type info in that way so it could be used with s->block_index[] */
v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2);
v->mb_type_base = av_mallocz(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2);
if (!v->mb_type_base)
goto error;
v->mb_type[0] = v->mb_type_base + s->b8_stride + 1;
@@ -608,6 +608,7 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
av_freep(&v->hrd_rate);
av_freep(&v->hrd_buffer);
ff_mpv_common_end(&v->s);
memset(v->s.block_index, 0, sizeof(v->s.block_index));
av_freep(&v->mv_type_mb_plane);
av_freep(&v->direct_mb_plane);
av_freep(&v->forward_mb_plane);
+1 -1
View File
@@ -984,7 +984,7 @@ static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f);
if (s->slice_min_bytes < 0)
if (s->slice_min_bytes < 0 || s->slice_max_bytes > INT_MAX >> 3)
return AVERROR(EINVAL);
ret = encode_frame(s, avpkt, frame, aux_data, header_size, s->interlaced);
+4 -2
View File
@@ -1451,8 +1451,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
vorbis_codebook codebook = vc->codebooks[vqbook];
if (get_bits_left(gb) <= 0)
return AVERROR_INVALIDDATA;
if (get_bits_left(gb) < 0) {
av_log(vc->avctx, AV_LOG_ERROR, "Overread %d bits\n", -get_bits_left(gb));
return 0;
}
if (vr_type == 0) {
+8
View File
@@ -318,7 +318,11 @@ static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)
// The arm/aarch64 _hv filters read one more row than what actually is
// needed, so switch to emulated edge one pixel sooner vertically
// (!!my * 5) than horizontally (!!mx * 4).
// The arm/aarch64 _h filters read one more pixel than what actually is
// needed, so switch to emulated edge if that would read beyond the bottom
// right block.
if (x < !!mx * 3 || y < !!my * 3 ||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
ref - !!my * 3 * ref_stride - !!mx * 3 * bytesperpixel,
@@ -357,7 +361,11 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m
// The arm/aarch64 _hv filters read one more row than what actually is
// needed, so switch to emulated edge one pixel sooner vertically
// (!!my * 5) than horizontally (!!mx * 4).
// The arm/aarch64 _h filters read one more pixel than what actually is
// needed, so switch to emulated edge if that would read beyond the bottom
// right block.
if (x < !!mx * 3 || y < !!my * 3 ||
((ARCH_AARCH64 || ARCH_ARM) && (x + !!mx * 5 > w - bw) && (y + !!my * 5 + 1 > h - bh)) ||
x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
ref_u - !!my * 3 * src_stride_u - !!mx * 3 * bytesperpixel,
+3
View File
@@ -739,6 +739,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role,
ref_x = FFMAX(0, ref_x);
ref_y = FFMAX(0, ref_y);
if (ref_y == y && ref_x >= x)
return AVERROR_INVALIDDATA;
/* copy pixels
* source and dest regions can overlap and wrap lines, so just
* copy per-pixel */
+5
View File
@@ -1491,6 +1491,8 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
/* Parse frame type ("frame header"), see frame_descs */
int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)], block_nsamples;
pitch[0] = INT_MAX;
if (bd_idx < 0) {
av_log(ctx, AV_LOG_ERROR,
"Invalid frame type VLC code, skipping\n");
@@ -1608,6 +1610,9 @@ static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
double i_lsps[MAX_LSPS];
float lpcs[MAX_LSPS];
if(frame_descs[bd_idx].fcb_type >= FCB_TYPE_AW_PULSES && pitch[0] == INT_MAX)
return AVERROR_INVALIDDATA;
for (n = 0; n < s->lsps; n++) // LSF -> LSP
i_lsps[n] = cos(0.5 * (prev_lsps[n] + lsps[n]));
ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1);
+1
View File
@@ -163,6 +163,7 @@ cglobal add_png_paeth_prediction, 5, 7, %1, dst, src, top, w, bpp, end, cntr
dec cntrq
jge .bpp_loop
POP dstq
emms
RET
%endmacro
+3
View File
@@ -614,6 +614,9 @@ static int xan_decode_frame(AVCodecContext *avctx,
return AVERROR_INVALIDDATA;
}
if (buf_size < 9)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
+3 -3
View File
@@ -95,10 +95,10 @@ struct video_data {
int (*open_f)(const char *file, int oflag, ...);
int (*close_f)(int fd);
int (*dup_f)(int fd);
#ifdef __GLIBC__
int (*ioctl_f)(int fd, unsigned long int request, ...);
#else
#if HAVE_POSIX_IOCTL
int (*ioctl_f)(int fd, int request, ...);
#else
int (*ioctl_f)(int fd, unsigned long int request, ...);
#endif
ssize_t (*read_f)(int fd, void *buffer, size_t n);
void *(*mmap_f)(void *start, size_t length, int prot, int flags, int fd, int64_t offset);
+1 -1
View File
@@ -186,7 +186,7 @@ static av_cold int init(AVFilterContext *ctx)
sign = 1;
while (1) {
gain = 1;
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
if (sscanf(arg, "%lf%n *%n", &gain, &len, &len) >= 1)
arg += len;
if (parse_channel_name(&arg, &in_ch_id, &named)){
av_log(ctx, AV_LOG_ERROR,
+5
View File
@@ -372,6 +372,11 @@ static av_cold int init_audio(AVFilterContext *ctx)
if (!(s->fifo = av_fifo_alloc(sizeof(AVFrame*))))
return AVERROR(ENOMEM);
if (s->sample_rate <= 0) {
av_log(ctx, AV_LOG_ERROR, "Sample rate not set\n");
return AVERROR(EINVAL);
}
if (!s->time_base.num)
s->time_base = (AVRational){1, s->sample_rate};
+5 -4
View File
@@ -343,13 +343,14 @@ static int config_props(AVFilterLink *link)
if(yadif->mode&1)
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
if (link->w < 3 || link->h < 4) {
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");
yadif->csp = av_pix_fmt_desc_get(link->format);
yadif->filter = filter;
if (AV_CEIL_RSHIFT(link->w, yadif->csp->log2_chroma_w) < 3 || AV_CEIL_RSHIFT(link->h, yadif->csp->log2_chroma_h) < 4) {
av_log(ctx, AV_LOG_ERROR, "Video with planes less than 3 columns or 4 lines is not supported\n");
return AVERROR(EINVAL);
}
yadif->csp = av_pix_fmt_desc_get(link->format);
yadif->filter = filter;
if (yadif->csp->comp[0].depth > 8) {
s->filter_intra = filter_intra_16bit;
s->filter_line = filter_line_c_16bit;
+2 -2
View File
@@ -345,8 +345,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
int err;
double peak = ctx->peak;
AVHWFramesContext *input_frames_ctx =
(AVHWFramesContext*)input->hw_frames_ctx->data;
AVHWFramesContext *input_frames_ctx;
av_log(ctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
av_get_pix_fmt_name(input->format),
@@ -354,6 +353,7 @@ static int tonemap_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
if (!input->hw_frames_ctx)
return AVERROR(EINVAL);
input_frames_ctx = (AVHWFramesContext*)input->hw_frames_ctx->data;
output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!output) {
+2 -1
View File
@@ -129,7 +129,8 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
avio_read(pb, buf, 8); /* APETAGEX */
if(avio_read(pb, buf, 8) != 8) /* APETAGEX */
return 0;
if (strncmp(buf, APE_TAG_PREAMBLE, 8)) {
return 0;
}
+2 -2
View File
@@ -438,7 +438,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
return AVERROR_INVALIDDATA;
av_freep(pb);
ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp);
ret = ffio_open_whitelist(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, s->protocol_whitelist, s->protocol_blacklist);
if (ret >= 0) {
// update cookies on http response with setcookies.
char *new_cookies = NULL;
@@ -1190,7 +1190,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
close_in = 1;
av_dict_copy(&opts, c->avio_opts, 0);
ret = avio_open2(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts);
ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
av_dict_free(&opts);
if (ret < 0)
return ret;
+2
View File
@@ -119,6 +119,8 @@ static int dxa_read_header(AVFormatContext *s)
avio_skip(pb, fsize);
}
c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames;
if (c->bpc < 0)
return AVERROR_INVALIDDATA;
if(ast->codecpar->block_align) {
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
return AVERROR_INVALIDDATA;
+5 -1
View File
@@ -2325,7 +2325,11 @@ static const AVOption hls_options[] = {
OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, INT_MAX, FLAGS},
{"allowed_extensions", "List of file extensions that hls is allowed to access",
OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
{.str = "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
{.str = "3gp,aac,avi,ac3,eac3,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,vtt,wav,webvtt"
",cmfv,cmfa" // Ticket11526 www.nicovideo.jp
",ec3" // part of Ticket11435 (Elisa Viihde (Finnish online recording service))
",fmp4" // https://github.com/yt-dlp/yt-dlp/issues/12700
},
INT_MIN, INT_MAX, FLAGS},
{"max_reload", "Maximum number of times a insufficient list is attempted to be reloaded",
OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
+1 -1
View File
@@ -204,7 +204,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AV_WL32(buf + 32, image->nb_pal);
}
if (image->nb_pal > INT_MAX / 4 - 14 - 40)
if (image->nb_pal > INT_MAX / 4 - 14 - 40U)
return AVERROR_INVALIDDATA;
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
+3
View File
@@ -359,6 +359,9 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
uint64_t chunk_pos, data_pos, data_size;
int ret = AVERROR_EOF;
if (s->nb_streams < 1)
return AVERROR_INVALIDDATA;
while (!avio_feof(pb)) {
chunk_pos = avio_tell(pb);
if (chunk_pos >= iff->body_end)
+2 -1
View File
@@ -74,7 +74,8 @@ static int ilbc_read_header(AVFormatContext *s)
AVStream *st;
uint8_t header[9];
avio_read(pb, header, 9);
if (avio_read(pb, header, 9) != 9)
return AVERROR_INVALIDDATA;
st = avformat_new_stream(s, NULL);
if (!st)
+1
View File
@@ -518,6 +518,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
goto fail;
} else {
memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
s->img_count++;
s->img_number++;
s->pts++;
+2 -1
View File
@@ -639,7 +639,8 @@ static int ipmovie_read_header(AVFormatContext *s)
ipmovie->avf = s;
avio_read(pb, signature_buffer, sizeof(signature_buffer));
if (avio_read(pb, signature_buffer, sizeof(signature_buffer)) != sizeof(signature_buffer))
return AVERROR_INVALIDDATA;
while (memcmp(signature_buffer, signature, sizeof(signature))) {
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
+3 -3
View File
@@ -94,15 +94,15 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt)
if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) {
av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n");
return AVERROR(EIO);
return AVERROR_INVALIDDATA;
}
if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) {
av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size);
return AVERROR(EIO);
return AVERROR_INVALIDDATA;
}
if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
return AVERROR(EIO);
return ret < 0 ? ret : AVERROR(EIO);
avio_skip(pb, padding);
+4 -3
View File
@@ -4070,9 +4070,10 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
// The prebuffer ends in the last Cue. Estimate how much data was
// prebuffered.
pre_bytes = desc_end.end_offset - desc_end.start_offset;
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
if (pre_ns <= 0)
if (desc_end.end_time_ns <= desc_end.start_time_ns ||
desc_end.end_time_ns - (uint64_t)desc_end.start_time_ns > INT64_MAX)
return -1;
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
pre_sec = pre_ns / nano_seconds_per_second;
prebuffer_bytes +=
pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);
@@ -4085,7 +4086,7 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
if (desc_bytes <= 0)
if (desc_bytes <= 0 || desc_bytes > INT64_MAX/8)
return -1;
desc_sec = desc_ns / nano_seconds_per_second;
+14 -6
View File
@@ -80,13 +80,15 @@ static int check_file_header(AVIOContext *pb, uint64_t guid)
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, unsigned size)
{
char * value = av_malloc(size + 1);
int ret;
if (!value) {
avio_skip(pb, size);
return;
}
avio_read(pb, value, size);
if (!value[0]) {
ret = avio_read(pb, value, size);
if (ret != size || !value[0]) {
av_free(value);
return;
}
@@ -418,19 +420,25 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
if (size < 16)
return AVERROR_INVALIDDATA;
avio_skip(pb, 12); //timestamp, frameNumber
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
size -= 12;
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
if (size < 8)
return AVERROR_INVALIDDATA;
avio_skip(pb, 8); // cropPosX, cropPosY, panPosX, panPosY
size -= 8;
}
space = avio_rl32(pb);
if (size < space + 4LL)
return AVERROR_INVALIDDATA;
avio_skip(pb, space);
size -= space;
if ((mlv->class[st->id] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) {
ret = AVERROR_PATCHWELCOME;
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
ret = av_get_packet(pb, pkt, (st->codecpar->width * st->codecpar->height * st->codecpar->bits_per_coded_sample + 7) >> 3);
} else { // AVMEDIA_TYPE_AUDIO
if (space > UINT_MAX - 24 || size < (24 + space))
return AVERROR_INVALIDDATA;
ret = av_get_packet(pb, pkt, size - (24 + space));
ret = av_get_packet(pb, pkt, size - 4);
}
if (ret < 0)
+5
View File
@@ -5260,6 +5260,11 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
c->fc->nb_streams-1, i, e->time);
return AVERROR_INVALIDDATA;
}
if (e->duration < 0) {
av_log(c->fc, AV_LOG_ERROR, "Track %d, edit %d: Invalid edit list duration=%"PRId64"\n",
c->fc->nb_streams-1, i, e->duration);
return AVERROR_INVALIDDATA;
}
}
sc->elst_count = i;
+3 -1
View File
@@ -563,7 +563,9 @@ redo:
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
unsigned char buf[8];
avio_read(s->pb, buf, 8);
ret = avio_read(s->pb, buf, 8);
if (ret != 8)
return AVERROR_INVALIDDATA;
avio_seek(s->pb, -8, SEEK_CUR);
if (!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
codec_id = AV_CODEC_ID_CAVS;
+2
View File
@@ -1626,6 +1626,8 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
MP4DescrParseContext d;
int ret;
d.predefined_SLConfigDescriptor_seen = 0;
ret = init_MP4DescrParseContext(&d, s, buf, size, descr, max_descr_count);
if (ret < 0)
return ret;
+2 -1
View File
@@ -247,7 +247,8 @@ static int read_table(AVFormatContext *avctx, AVStream *st,
if (avio_feof(pb))
return AVERROR_EOF;
avio_read(pb, name, 16);
if (avio_read(pb, name, 16) != 16)
return AVERROR_INVALIDDATA;
name[sizeof(name) - 1] = 0;
size = avio_rb32(pb);
if (size < 0) {
+11 -4
View File
@@ -608,7 +608,8 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
if (size < 32 || size - 32 < orig_size || (int)orig_size != orig_size)
return AVERROR_INVALIDDATA;
avio_read(pb, ivec, 16);
avio_read(pb, tmpbuf, 16);
if (avio_read(pb, tmpbuf, 16) != 16)
return AVERROR_INVALIDDATA;
if (mxf->aesc)
av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
if (memcmp(tmpbuf, checkv, 16))
@@ -1272,7 +1273,8 @@ static int mxf_read_indirect_value(void *arg, AVIOContext *pb, int size)
if (size <= 17)
return 0;
avio_read(pb, key, 17);
if (avio_read(pb, key, 17) != 17)
return AVERROR_INVALIDDATA;
/* TODO: handle other types of of indirect values */
if (memcmp(key, mxf_indirect_value_utf16le, 17) == 0) {
return mxf_read_utf16le_string(pb, size - 17, &tagged_value->value);
@@ -1615,6 +1617,11 @@ static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t
return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out, partition_out);
} else {
/* EditUnitByteCount == 0 for VBR indexes, which is fine since they use explicit StreamOffsets */
if (s->edit_unit_byte_count && (s->index_duration > INT64_MAX / s->edit_unit_byte_count ||
s->edit_unit_byte_count * s->index_duration > INT64_MAX - offset_temp)
)
return AVERROR_INVALIDDATA;
offset_temp += s->edit_unit_byte_count * s->index_duration;
}
}
@@ -3313,7 +3320,7 @@ static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_
a = -1;
b = track->original_duration;
while (b - 1 > a) {
m = (a + b) >> 1;
m = (a + (uint64_t)b) >> 1;
if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0)
return -1;
if (offset < current_offset)
@@ -3383,7 +3390,7 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, AVStream *st, int64_t
int64_t new_edit_unit;
MXFIndexTable *t = mxf_find_index_table(mxf, track->index_sid);
if (!t || track->wrapping == UnknownWrapped)
if (!t || track->wrapping == UnknownWrapped || edit_unit > INT64_MAX - track->edit_units_per_packet)
return -1;
if (mxf_edit_unit_absolute_offset(mxf, t, edit_unit + track->edit_units_per_packet, track->edit_rate, NULL, &next_ofs, NULL, 0) < 0 &&
+1 -1
View File
@@ -34,7 +34,7 @@ static int nist_probe(const AVProbeData *p)
static int nist_read_header(AVFormatContext *s)
{
char buffer[256], coding[32] = "pcm", format[32] = "01";
char buffer[256]= {0}, coding[32] = "pcm", format[32] = "01";
int bps = 0, be = 0;
int32_t header_size = -1;
AVStream *st;
+2 -1
View File
@@ -188,7 +188,8 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
st->codecpar->channels = avio_rb16(pb);
if (version == 5) {
ast->deint_id = avio_rl32(pb);
avio_read(pb, buf, 4);
if (avio_read(pb, buf, 4) != 4)
return AVERROR_INVALIDDATA;
buf[4] = 0;
} else {
AV_WL32(buf, 0);
+1 -1
View File
@@ -101,7 +101,7 @@ static AVRational read_fps(const char* line, int* error)
line++;
for (; *line>='0' && *line<='9'; line++) {
// Truncate any numerator too large to fit into an int64_t
if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
if (num > (INT64_MAX - 9) / 10ULL || den > INT64_MAX / 10ULL)
break;
num = 10 * num + (*line - '0');
den *= 10;
+1
View File
@@ -239,6 +239,7 @@ static int film_read_header(AVFormatContext *s)
else if (film->audio_type != AV_CODEC_ID_NONE)
audio_frame_counter += (film->sample_table[i].sample_size /
(film->audio_channels * film->audio_bits / 8));
film->sample_table[i].keyframe = 1;
} else {
film->sample_table[i].stream = film->video_stream_index;
film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
+2 -1
View File
@@ -565,7 +565,8 @@ static int viv_read_header(AVFormatContext *s)
v = avio_r8(pb);
avio_seek(pb, v, SEEK_CUR);
avio_read(pb, keybuffer, 187);
if (avio_read(pb, keybuffer, 187) != 187)
return AVERROR_INVALIDDATA;
key = decode_key(keybuffer);
viv->sb_key = key;
+2 -1
View File
@@ -61,7 +61,8 @@ static void add_metadata(AVFormatContext *s, uint32_t tag,
buf = av_malloc(len+1);
if (!buf)
return;
avio_read(s->pb, buf, len);
if (len != avio_read(s->pb, buf, len))
return;
buf[len] = 0;
AV_WL32(key, tag);
av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);
+1 -2
View File
@@ -804,8 +804,7 @@ static int w64_read_header(AVFormatContext *s)
uint8_t guid[16];
int ret;
avio_read(pb, guid, 16);
if (memcmp(guid, ff_w64_guid_riff, 16))
if (avio_read(pb, guid, 16) != 16 || memcmp(guid, ff_w64_guid_riff, 16))
return AVERROR_INVALIDDATA;
/* riff + wave + fmt + sizes */
+4 -3
View File
@@ -183,7 +183,7 @@ static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length,
int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4);
int i;
wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS);
wf->sectors = av_calloc(nb_sectors1, 1 << WTV_SECTOR_BITS);
if (!wf->sectors) {
av_free(wf);
return NULL;
@@ -850,7 +850,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
int stream_index = ff_find_stream_index(s, sid);
if (stream_index >= 0) {
AVStream *st = s->streams[stream_index];
uint8_t buf[258];
uint8_t buf[258] = {0};
const uint8_t *pbuf = buf;
int buf_size;
@@ -863,7 +863,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
}
buf_size = FFMIN(len - consumed, sizeof(buf));
avio_read(pb, buf, buf_size);
if (avio_read(pb, buf, buf_size) != buf_size)
return AVERROR_INVALIDDATA;
consumed += buf_size;
ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, NULL, 0, 0, NULL);
}
+4 -2
View File
@@ -451,10 +451,12 @@ int av_match_list(const char *name, const char *list, char separator)
if (k && (!p[k] || p[k] == separator))
return 1;
q = strchr(q, separator);
q += !!q;
if(q)
q++;
}
p = strchr(p, separator);
p += !!p;
if (p)
p++;
}
return 0;
+4 -4
View File
@@ -27,8 +27,8 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#elif defined(__OpenBSD__)
#include <sys/param.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#elif defined(__AMIGAOS4__)
@@ -56,8 +56,8 @@ int ff_get_cpu_flags_ppc(void)
if (result == VECTORTYPE_ALTIVEC)
return AV_CPU_FLAG_ALTIVEC;
return 0;
#elif defined(__APPLE__) || defined(__OpenBSD__)
#ifdef __OpenBSD__
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__NetBSD__) || defined(__OpenBSD__)
int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
#else
int sels[2] = {CTL_HW, HW_VECTORUNIT};
+5
View File
@@ -950,6 +950,11 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
int minStride= FFMAX(FFABS(srcStride[0]), FFABS(dstStride[0]));
int absQPStride = FFABS(QPStride);
if (width < 16 || height < 16) {
av_log(c, AV_LOG_ERROR, "Postproc is designed to filter 16x16 macroblock based formats, the minimum size is 1 macroblock\n");
return;
}
// c->stride and c->QPStride are always positive
if(c->stride < minStride || c->qpStride < absQPStride)
reallocBuffers(c, width, height,
+17 -17
View File
@@ -1087,8 +1087,8 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
av_assert2(uvalpha <= 4096U);
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
unsigned Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
unsigned Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14;
int R, G, B;
@@ -1112,20 +1112,20 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
A2 += 1 << 13;
}
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16));
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
if (eightbytes) {
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
dest += 8;
} else {
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
dest += 6;
}
}
@@ -1286,9 +1286,9 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
B = U * c->yuv2rgb_u2b_coeff;
// 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y)>>14) + (1<<15), 16));
output_pixel(&dest[1], av_clip_uintp2((( G + Y)>>14) + (1<<15), 16));
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y)>>14) + (1<<15), 16));
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + (1<<15), 16));
output_pixel(&dest[1], av_clip_uintp2(((int)( G + (unsigned)Y)>>14) + (1<<15), 16));
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + (1<<15), 16));
if (eightbytes) {
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
dest += 4;
@@ -2199,9 +2199,9 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
Y -= c->yuv2rgb_y_offset;
Y *= c->yuv2rgb_y_coeff;
Y += 1 << (SH-1);
R = Y + V * c->yuv2rgb_v2r_coeff;
G = Y + V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
B = Y + U * c->yuv2rgb_u2b_coeff;
R = Y + V * (unsigned)c->yuv2rgb_v2r_coeff;
G = Y + V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff;
B = Y + U * (unsigned)c->yuv2rgb_u2b_coeff;
if ((R | G | B) & 0xC0000000) {
R = av_clip_uintp2(R, 30);
+1 -1
View File
@@ -59,7 +59,7 @@ static int alloc_lines(SwsSlice *s, int size, int width)
for (j = 0; j < n; ++j) {
// chroma plane line U and V are expected to be contiguous in memory
// by mmx vertical scaler code
s->plane[i].line[j] = av_malloc(size * 2 + 32);
s->plane[i].line[j] = av_mallocz(size * 2 + 32);
if (!s->plane[i].line[j]) {
free_lines(s);
return AVERROR(ENOMEM);
+1 -1
View File
@@ -225,7 +225,7 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
int i;
int32_t *dst = (int32_t *) _dst;
for (i = 0; i < width; i++)
dst[i] = (dst[i]*(14071/4) + (33561947<<4)/4)>>12;
dst[i] = ((int)(dst[i]*(14071U/4) + (33561947<<4)/4)) >> 12;
}