Commit graph

118359 commits

Author SHA1 Message Date
91d96dc8dd
avformat/hls: Be more picky on extensions
This blocks disallowed extensions from probing
It also requires all available segments to have matching extensions to the format
mpegts is treated independent of the extension

It is recommended to set the whitelists correctly
instead of depending on extensions, but this should help a bit,
and this is easier to backport

Fixes: CVE-2023-6602 II. HLS Force TTY Demuxer
Fixes: CVE-2023-6602 IV. HLS XBIN Demuxer DoS Amplification

The other parts of CVE-2023-6602 have been fixed by prior commits

Found-by: Harvey Phillips of Amazon Element55 (element55)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-26 01:12:28 +01:00
c733e2b5ed
Revert "avformat/mpegts: Add standard extension so hls can check in extension_picky mode"
The next commit implements the hls fix in a way that doesnt need this

This reverts commit 54897da7ce.
2025-01-26 01:12:28 +01:00
Manuel Lauss
d68d311bcd
avcodec/sanm: codec37 buffers are private
codec37 operates on 2 buffers, which must be considered private to
the codec and must therefore not be changed by subsequent FOBJs.

Let codec37 therefore operate on frm1/2 instead of frm0/2, but copy
the decoded image to frm0 where other codecs operate on.

Fixes artifacts encountered in Full Throttle "dazed.san" and also
in a lot of Rebel Assault II gameplay videos: these videos consist of
frames with an initial codec37 FOBJ image to set the stage, and
optional codec1-23 FOBJs overlaid on top of that image.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-26 01:10:52 +01:00
4322be512b
avcodec/svq1enc: restrict Altivec acceleration to big-endian POWER configurations
This was disabled in da60b99a88 and then
accidentally re-enabled in 172b0e2e88.

The code in question was never properly adapted for litte-endian mode.

refs: trac/10955
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-26 01:10:52 +01:00
Marton Balint
ec4d3dc5b9 avcodec/mpegvideo_enc: use 64bit multiplication in dct_quantize_trellis_c and dct_quantize_c
Fixes corruption with:

ffmpeg -t 1 -filter_complex "sine=f=21,showwaves=scale=cbrt:mode=line:colors=white:draw=full" -c:v mpeg2video -non_linear_quant 1 -qmin 1 -qmax 1 -cpuflags 0 out.mpg

or

ffmpeg -t 1 -filter_complex "sine=f=21,showwaves=scale=cbrt:mode=line:colors=white:draw=full" -c:v mpeg2video -non_linear_quant 1 -qmin 1 -qmax 1 -trellis 1 out.mpg

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-25 20:10:41 +01:00
Marton Balint
ed26812337 avcodec/mpegvideo_enc: fix qmat value comments
The comments supposed to track the possible value of the qmat and qmat16
matrices, but they were not updated properly in the long history of the
mpegvideo encoder. Also they wrongly assumed the usage of built-in quantizer
matrices and linear quantization.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-25 20:10:41 +01:00
Marton Balint
7d9f373984 avcodec/mpegvideo_enc: add checks for custom inter/intra/chroma matrices
Make the checker functions available for all codecs.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-25 20:10:41 +01:00
sunyuechi
a0a89efd07 Fix the tail handling in R-V V sad
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2025-01-25 09:37:45 +02:00
James Almer
e20ee9f9ae swscale/swscale: don't reject scaling when color parameters are not supported but conversion is not required
Values in csp, prim, trc, etc, are irrelevant if there's no conversion needed.

Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-22 12:15:18 -03:00
James Almer
abdc20727c swscale/swscale: combine the input/output checks in sws_frame_setup()
Cosmetic change in preparation for the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-22 12:14:57 -03:00
6ecc96f4d0
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>
2025-01-21 22:55:11 +01:00
90ff3ae976
tools/target_swr_fuzzer: do not use negative numbers of samples
Fixes: signed integer overflow: -277109688 * 8 cannot be represented in type 'int'
Fixes: 376118159/clusterfuzz-testcase-minimized-ffmpeg_SWR_fuzzer-5884436320681984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 22:55:10 +01:00
ef71552cf9
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>
2025-01-21 22:55:10 +01:00
aec2933344
avformat/iamf_reader: Initialize padding and check read in ff_iamf_read_packet()
Fixes: Use of uninitialized memory
Fixes: 377642312/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4554550985424896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 22:55:10 +01:00
788abe0d25
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>
2025-01-21 22:55:09 +01:00
17b019c517
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>
2025-01-21 22:55:09 +01:00
e81d410242
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>
2025-01-21 22:55:09 +01:00
49fa3f6c5b
avformat/vqf: Propagate errors from add_metadata()
Suggested-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 22:55:08 +01:00
c43dbecbda
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>
2025-01-21 22:55:08 +01:00
54897da7ce
avformat/mpegts: Add standard extension so hls can check in extension_picky mode
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:14 +01:00
665b0cf3bf
swscale: 16bit planar float input support
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:14 +01:00
62c98cdd54
avcodec/ffv1enc: Fix RCT for GBR colorspace
It performs better when its less buggy

Compression changes for rgb_scanline_half_piz_dw_t08 (using float16 with remaping) from
56086 byte to 34371
(with a single slice its 28122 byte)

prior remap it was 188186 bytes

ACES_OT_VWG_SampleFrames/ACES_OT_VWG_SampleFrames improves too but only by a fraction of a percent

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:13 +01:00
497b205ad5
avcodec/ffv1enc: dont reset version
resetting the version causes any previously set values to be disregarded

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:13 +01:00
0c237d6e8a
avcodec/ffv1: simplify version checks with combined_version
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:13 +01:00
c0769e9213
libavutil/pixfmt: 16bit float support
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-21 21:06:12 +01:00
5e4a510cce
ffv1dec: move slice decoding into a separate function
This simply movies all slice decoding code from decode_frame
to decode_slices; nothing more.
2025-01-22 00:09:38 +09:00
f75812e054
ffv1dec: move header parsing into a separate function 2025-01-22 00:09:38 +09:00
d987feae2a
ffv1dec: move slice start finding into a function
This also cleans up and gives the code some much needed comments.
2025-01-22 00:09:37 +09:00
7187eadf8c
ffv1dec: use dedicated pix_fmt field and call ff_get_format
Adding support for hwaccels means that avctx->pix_fmt will indicate
hardware formats.
2025-01-22 00:09:37 +09:00
5c59e6ce19
vulkan: enable using .elems field for buffer content definitions
This avoids needing to snprintf when the buffer only contains an array of a struct,
while letting the validation layers detect errors more reliably.
2025-01-22 00:09:32 +09:00
Lingyi Kong
504df09c34 avcodec/h264: fix stride calculation in slice_table for multi-slice field video deblocking
fix for https://trac.ffmpeg.org/ticket/11360
A new fate test case is added to validate the fix, the smaple file is located at https://trac.ffmpeg.org/attachment/ticket/11360/slice2_field_aurora4.264.

Signed-off-by: Lingyi Kong <konglingyi@visionular.com>
2025-01-20 08:50:01 +00:00
James Almer
bb033e6910 avcodec/ac3dec: only export matrix encoding and downmix info side data when necessary
Don't export a matrix encoding side data when there's none signaled.
And if downmixing was handled by the decoder itself, then the downmix info does
not apply to the frame.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-19 15:14:18 -03:00
James Almer
4563cf95ca avcodec/ac3dec: don't override existing downmix coefficient with default ones
With this, if the eac3 dependent frame doesn't have coded downmix values when
parsed by ff_eac3_parse_header(), it will inherit the coded ones from the core
ac3 frame instead of ignoring them.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-19 15:14:18 -03:00
Zhao Zhili
ea381285e7 avcodec/vvc: Add support for output_corrupt/showall flags 2025-01-19 13:30:13 +08:00
James Almer
a328b219ed fate/tests/flvenc: add missing ffprobe dependency to fate-enhanced-flv-multitrack
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-18 18:20:52 -03:00
a3e506455e avformat/flvdec: correctly skip command frame for enhanced flv 2025-01-18 21:57:02 +01:00
ced9fddec0 avformat/flvdec: implement support for parsing ModEx data 2025-01-18 21:57:02 +01:00
4c96d6bf75
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>
2025-01-17 23:33:27 +01:00
c6c54943d1
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>
2025-01-17 23:33:26 +01:00
Stefan Pöschel
2ac2ebcd76
doc/protocols: fix/improve RTP documentation
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-17 23:33:26 +01:00
Manuel Lauss
9a794897c3
avcodec/sanm: simplify codec37 subcodec 3/4 path
A flag in the codec header determines whether opcodes 0xfd/0xfe
are to be treated as special or not.  The current code has 2
implementations of the same decoding scheme, with one treating
the 2 opcodes as special, the other not.
Collapse them into a single implementation and treat these opcode
according to the flag.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-17 23:33:25 +01:00
Manuel Lauss
fff7737b3d
avcodec/sanm: implement codec37 subcodec1
RLE-compressed stream of motion vector indices and a special opcode
to fill a block with data from the source stream.

It is used in the LucasArts "Full Throttle" blink*.san animations.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Fixes: Ticket5753
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-17 23:33:25 +01:00
James Almer
c08d300481 avformat/avformat: also clear FFFormatContext packet queue when closing a muxer
packet_buffer is used in mux.c, and if a muxing process fails at a point where
packets remained in said queue, they will leak.

Fixes ticket #11419

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-17 10:10:51 -03:00
Zhao Zhili
4f3c9f2f03 avcodec/mediacodecenc: Support config qp range
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-01-15 15:05:50 +08:00
Zhao Zhili
ff00037368 avcodec/cuviddec: Fix missing HW_CONFIG_METHOD_HW_FRAMES_CTX flag
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-01-15 15:05:45 +08:00
Zhao Zhili
d157e1f16b avcodec/bit_depth_template: Remove empty macro INIT_CLIP
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-01-15 15:05:37 +08:00
66e9888bf4
avfilter/vf_v360: Fix NULL pointer use
Fixes: applying zero offset to null pointer
partly Fixes: verysmall.flv

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-15 01:27:46 +01:00
827c073154
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>
2025-01-15 01:27:46 +01:00
402824e9e9
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>
2025-01-15 01:27:45 +01:00
afbc3a1b23
avformat/mov: perform sanity checks for heif before index building
Fixes: undefined NULL pointer use
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-6363211175493632

This performs equivalent sanity checks as are done in mov_read_trak()
before mov_build_index()

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-15 01:27:45 +01:00