1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

120372 Commits

Author SHA1 Message Date
9658d4425e avcodec/x86/fdct: guard usage of undefined functions with preprocessor
The asumption is that DCE will remove references to those functions.
However some compilers with certain instrumentation enabled doesn't DCE
those at all, resulting in linking failure. Tested with cl.exe -RTCu -RTCs.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
6bc23ab352 avcodec/d3d12va_encode_hevc: remove unused variable
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
62e2af358d avcodec/d3d12va_encode: don't return uninitialized value on error
When CreateEvent fails, err was not initialized.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
7d9b21601c avcodec/d3d12va_encode: don't write garbage when there is no header
When codec->write_sequence_header is not defined, bit_len was undefined,
and while data bufer was zeroed we could just overread it. Do nothing
when we don't have anything to write.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
a1588c875a avcodec/d3d12va_encode: use correct none flag
NFC, it's still 0, but correct enum type so compilers won't complain.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
c1ccd4bb22 avcodec/d3d12va_decode: remove unused variable
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
a9b9636046 avformat/vivo: fix sscanf specifer for double
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
c6ea6ac39b avformat/os_support: check invalid socket value correctly on Windows
SOCKET defined in winsock2.h is unsigned and invalid value is defined as
INVALID_SOCKET. Check this explicity to avoid compiler warnings.

See: https://learn.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:16 +02:00
d6b72d1d26 avformat/options_table: supress implicit conversion warnings
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-25 21:10:13 +02:00
45810daf4d avfilter/af_channelmap: always set out_channel in the map
Fixes use-of-uninitialized-value.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-25 00:18:07 -03:00
829680f96a avcodec/jpegxl_parser: add sanity check for frame size
If a frame size is absolutely massive, this can spin the parser as it
attempts to decode a permuted TOC. We add a sanity check here for eight
times the size of the image for an internal frame to prevent malicious
bitstreams from slowing the parser down to a crawl.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-23 06:22:16 -04:00
3f2b452a22 avcodec/opus/silk: don't assume stereo when calling silk_decode_frame()
Fixes use-of-uninitialized-value under MSAN.

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 22:16:25 -03:00
33e326ae02 forgejo/workflows: add initial rudimentary CI
It runs basic fate with no special dependencies enabled on x86_64 and
aarch64.
2025-07-22 20:06:20 +02:00
c64f6812eb configure: suppress Wmicrosoft-enum-forward-reference
Clang-CL complains about fwd references of enums, but we do use it
everywhere, so ignore this.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
22da57c444 swscale/lut3d: remove unused function
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
29d274afe7 avformat/udp: avoid warning about always false comparison
socklen_t underlying type can be signed or unsigned depending on
platform. This is fine, just cast it to size_t before comparison.

Fixes: warning: result of comparison of unsigned expression < 0 is
       always false [-Wtautological-unsigned-zero-compare]

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
ce04877f1f avutil/hmac: avoid calling functions through pointer of invalid type
Add type removed function wrappers to resolve UB of calling function
through pointer to incorrect function type.

Fixes: FATE-{hmac,srtp}
Fixes: call to function av_md5_init through pointer to incorrect
       function type 'void (*)(void *)' and similar for others.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
6f88b90f6c avutil/avstring: shrink allocation from av_get_token to fit token
av_get_token() allocates an output buffer with the same size as the
input. Generally, this is harmless, but when the input string is large
and consists of many small tokens, calling av_get_token() repeatedly to
extract all tokens will significantly amplify memory allocations.

To fix this, after obtaining the return value, simply realloc the buffer
to the actual size needed for output string.

Fixes OOM when parsing filter graph string.
Fixes OSS-Fuzz: 394983446

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
86670fec9c avcodec/ffv1dec: don't check chroma_planes for f->colorspace > 0
It's RGB, so check instead if it's packed or planar.

Fixes: libavcodec/ffv1dec.c:461:43: runtime error: applying zero offset to null pointer
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 12:37:31 -03:00
da18c2a373 avfilter: use the getters for xGA font data arrays
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
cb9742af76 avcodec: use the getters for xGA font data arrays
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
c6c8063186 avutil/xga_font_data: add getters to access the shared arrays
And stop exposing the arrays on the next major bump.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
e835738b70 avcodec/cbs_apv: add missing READ/WRITE preprocessor checks
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
b0159af6bc avfilter/f_metadata: use the return value of vsnprintf() to write the argument list
Should fix use-of-uninitialized-value under MSAN.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
87cc213748 avformat/hevc: don't print parameter_set_id for any NALU
It's not a value stored in the hvcC structure.
Fixes use of uninitialized variable errors under sanitizer when the input extradata is
already hvcC formatted, given we don't parse parameter sets for those.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
48ef4caac2 avcodec/ffv1dec: don't add offsets to more NULL pointers
Fixes: libavcodec/ffv1dec.c:453:43: runtime error: applying zero offset to null pointer
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:17 -03:00
080dc4cf54 avformat/tls_openssl: load default verify locations
When no explicit CAs file is set, load the default locations,
else there is no way for verification to succeed.

This matches the behavior of other TLS backends.
2025-07-22 02:43:54 +02:00
f4befeb767 avformat/tls_openssl: verify setting hostname for SNI 2025-07-22 02:43:54 +02:00
e56fd2af1a avformat/tls_openssl: add hostname for verification
When verification is enabled (using -tls_verify 1) now
the hostname will be verified properly too, while before
only other aspects of the certificate were checked.

Co-Authored-By: Marvin Scholz <epirat07@gmail.com>
2025-07-22 02:43:54 +02:00
3cd4fa9b89 libtheoraenc: Add encoding speed level option
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-22 01:35:01 +02:00
157d3b007e lavu: add av_scanf_format() and use it on av_sscanf()
Signed-off-by: Jacob Lifshay <programmerjake@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-22 01:35:01 +02:00
a01dc3aa27 avfilter/x86/vf_colordetect: add missing preprocessor checks
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 18:03:22 -03:00
c62813a057 avfilter/x86/vf_colordetect: make the AVX512 functions run only on ICL targets or newer
For detect_range, the usage of vpbroadcast{b,w} requires the AVX512BW extension, and for
detect_alpha we don't want ZMM instructions downclocking old CPUs.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 17:25:28 -03:00
b9287fde10 Changelog: add entry for vf_colorfilter addition
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 17:04:45 -03:00
550ec9b7e6 avfilter/version: bump version after vf_colordetect addition
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 17:04:45 -03:00
70fc4e5909 avfilter/x86/vf_colordetect_init: don't enable ASM functions on targets where it's known they will be slower
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 16:58:51 -03:00
fdca209f1f avfilter/x86/vf_colordetect: don't use rax to return a 32bit integer
Fixes compilation on x86_32 targets

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 16:58:36 -03:00
14f4478354 avfilter/x86/vf_colordetect: fix use of AVX512 instruction in AVX2 function on non Unix64 targets
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-21 16:52:46 -03:00
f944a70fcc tests/checkasm: add check for vf_colordetect 2025-07-21 18:10:26 +02:00
8b647b3f8a avfilter/vf_colordetect: add x86 SIMD implementation
alphadetect8_full_c:                                  5658.2 ( 1.00x)
alphadetect8_full_avx2:                                215.1 (26.31x)
alphadetect8_full_avx512:                              133.5 (42.40x)
alphadetect8_limited_c:                               7391.5 ( 1.00x)
alphadetect8_limited_avx2:                             649.3 (11.38x)
alphadetect8_limited_avx512:                           330.5 (22.36x)
alphadetect16_full_c:                                 3027.4 ( 1.00x)
alphadetect16_full_avx2:                               209.4 (14.46x)
alphadetect16_full_avx512:                             141.4 (21.41x)
alphadetect16_limited_c:                              3880.9 ( 1.00x)
alphadetect16_limited_avx2:                            734.9 ( 5.28x)
alphadetect16_limited_avx512:                          349.2 (11.11x)
rangedetect8_c:                                       5854.2 ( 1.00x)
rangedetect8_avx2:                                     138.9 (42.15x)
rangedetect8_avx512:                                   106.2 (55.12x)
rangedetect16_c:                                      4122.0 ( 1.00x)
rangedetect16_avx2:                                    138.6 (29.74x)
rangedetect16_avx512:                                  104.1 (39.60x)
2025-07-21 18:10:25 +02:00
545f721b44 avfilter/vf_colordetect: add new color range detection filter
This filter can detect various properties about the image, including
whether or not there are out-of-range values, or whether the input appears
to use straight or premultiplied alpha.

Of course, these can only be heuristics, with "undetermined" as the base
case. While we can definitely prove the existence of full range or
straight alpha colors, we can never infer the opposite.
2025-07-21 18:10:25 +02:00
8cdb47e47a avformat/concatdec: Clip duration in one more case in get_best_effort_duration()
Fixes: signed integer overflow: 40000 - -9223372036854770000 cannot be represented in type 'long'
Fixes: 427262541/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4831506940100608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-21 01:27:23 +02:00
749aaf2744 avcodec/smacker: cleanup on bet buffer failure
Fixes: memleak (of vlc)
Fixes: 430343927/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-5265858979233792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:24 +02:00
051e0d7744 avcodec/ffv1dec: Check k in get_vlc_symbol()
The true problem happens in several previous get_vlc_symbol()
but checking that is more expensive (involving FFABS())
here its just a simple check between 2 variables we have.

Fixes: Assertion log >= k failed at libavcodec/golomb.h:406
Fixes: 429296194/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_DEC_fuzzer-4691594622337024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:23 +02:00
c0f1c3e185 avcodec/ivi: Check luma/chroma mb_size
Fixes: shift exponent -1 is negative
Fixes: 429011224/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5031059358285824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:23 +02:00
2d72bf6fe0 avcodec/cfhd: Check idwt_buf size before allocation
Fixes: OOM
Fixes: 428760799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_DEC_fuzzer-5685176435015680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:23 +02:00
f7a6965308 fftools/cmdutils: Add av_freep() to avoid memory leak
Add av_freep() to free new_elem to avoid memory leak.

Fixes: 3ca1e31e63 ("fftools/cmdutils: Atomically add elements to list of pointers, fix crash")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-20 01:05:22 +02:00
85ac589211 avformat/apv: use memset to zero initialize frame_info
Don't rely on implicit zeroing.
Should fix fate failures on msvc targets.

Found-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-19 20:01:57 -03:00
722a2170e8 avfilter/vf_curves: don't add offsets to NULL pointers
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-19 00:07:45 -03:00
11032d819d swscale/swscale_unscaled: don't add offsets to more NULL pointers
Continuation of af9b43455a.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-18 21:35:26 -03:00