Commit Graph

116037 Commits

Author SHA1 Message Date
Kacper Michajłow
02b3fc5826
avformat/nuv: return early if header id fails to read
Fixes use of uninitialized value in memcmp below, reported by MSAN.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-27 23:28:46 +02:00
Zhao Zhili
6aeb084c39 avcodec/vvc: Don't create new thread when thread_count is 1
Make its behavior consistent with other decoders, e.g., H.264/H.265.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-06-27 20:54:42 +08:00
Zhao Zhili
baf3123c1c avutil/executor: Allowing thread_count be zero
Before the patch, disable threads support at configure/build time
was the only method to force zero thread in executor. However,
it's common practice for libavcodec to run on caller's thread when
user specify thread number to one. And for WASM environment, whether
threads are supported needs to be detected at runtime. So executor
should support zero thread at runtime.

A single thread executor can be useful, e.g., to handle network
protocol. So we can't take thread_count one as zero thread, which
disabled a valid usercase.

Other libraries take -threads 0 to mean auto. Executor as a low
level utils doesn't do cpu detect. So take thread_count zero as
zero thread, literally.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-06-27 20:54:42 +08:00
Frank Plowman
d79c926ab6 lavc/vvc: Validate IBC block vector
From H.266 (V3) (09/2023) p. 321:

It is a requirement of bitstream conformance that the luma block
vector bvL shall obey the following constraints:
- CtbSizeY is greater than or equal to
((yCb + (bvL[ 1 ] >> 4)) & (CtbSizeY − 1)) + cbHeight

This patch checks this is true, which fixes crashes on fuzzed
bitstreams.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-27 20:38:34 +08:00
Frank Plowman
c917c423e0 lavc/vvc: Don't discard return codes
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-06-27 20:36:13 +08:00
Gyan Doshi
9a3bc59a38 configure: fix alignment of conditional lib dependencies 2024-06-27 15:12:35 +05:30
Gyan Doshi
27284b7800 configure: fix assignment of dep libs for QR-code filters 2024-06-27 15:12:06 +05:30
Martin Storsjö
75e3b81f75 avcodec/vvcdec: Fix compiling with MSVC 2022 17.8 and older
Versions of MSVC older than 17.9 error out here with the following
error:

    src/libavcodec/vvc/filter.c(815): error C2059: syntax error: '}'
    src/libavcodec/vvc/filter.c(832): error C2065: 'all_zero_bs': undeclared identifier
    src/libavcodec/vvc/filter.c(836): error C2065: 'all_zero_bs': undeclared identifier

This was a regression from 5b9320b209.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-27 11:06:23 +03:00
Michael Niedermayer
1080116658
avcodec/aac/aacdec_usac: Test ac in usac
ff_aac_usac_config_decode() needs AACDecContext to be set but some callers
pass NULL.

Happens only when the LATM decoder is used, and USAC is not supported in
LATM

Fixes: member access within null pointer of type 'AACDecContext' (aka 'struct AACDecContext')
Fixes: 69435/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5733527483121664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:55:11 +02:00
Michael Niedermayer
c221c7422f
swscale/output: Avoid undefined overflow in yuv2rgb_write_full()
Fixes: signed integer overflow: -140140 * 16525 cannot be represented in type 'int'
Fixes: 68859/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4516387130245120

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:36 +02:00
Michael Niedermayer
9e6c5b6e86
swscale/output: alpha can become negative after scaling, use multiply
Fixes: left shift of negative value -3245
Fixes: 69047/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6571511551950848

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:36 +02:00
Paul B Mahol
c22488f718
avcodec/smcenc: make sure ny/nx are >= 0
(cherry picked from commit 5ad38785e7ad4067a288e9d5e8ce2c4ed2bf584a)

Fixes: out of array read
Fixes: 68939/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMC_fuzzer-587804104884224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:35 +02:00
Michael Niedermayer
4a7220bd5c
avcodec/targaenc: Allocate space for the palette
Fixes: out of array access
Fixes: 68927/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TARGA_fuzzer-5105665067515904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:35 +02:00
Michael Niedermayer
d34d4b6a7c
avcodec/r210enc: Use av_rescale for bitrate
Fixes: signed integer overflow: 281612954574848 * 65344 cannot be represented in type 'long'
Fixes: 68956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_R210_fuzzer-6459074458746880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:35 +02:00
Michael Niedermayer
228f255b5d
avcodec/jfdctint_template: Fewer integer anomalies
Fixes: signed integer overflow: 105788 * -20995 cannot be represented in type 'int'
Fixes: signed integer overflow: 923211729 + 2073948236 cannot be represented in type 'int'
Fixes: signed integer overflow: 1281179284 + 2073948236 cannot be represented in type 'int'
Fixes: 68975/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_fuzzer-6266769177116672
Fixes: 68997/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_KS_fuzzer-6284237161431040

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:34 +02:00
Michael Niedermayer
3a9292aff3
avcodec/snowenc: MV limits due to mv_penalty table size
Fixes: out of array read
Fixes: 69673/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5476592894148608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:34 +02:00
Michael Niedermayer
eb9c96a82f
avcodec/ratecontrol: Try to keep fps as a rational
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:34 +02:00
Michael Niedermayer
f81602fb3a
tools/target_dec_fuzzer: Adjust threshold for MV30
Fixes: 60867/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-6381933108527104
Fixes: Timeout

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:33 +02:00
Michael Niedermayer
749994194c
tools/target_dec_fuzzer: Adjust threshold for jpeg2000
Fixes: Timeout
Fixes: 57385/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5394334324490240

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-26 20:49:25 +02:00
J. Dekker
e61fed8280 avutil/riscv/cpu: fix __riscv_v_min_vlen typo
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-06-26 12:50:02 +02:00
Brad Smith
41190da9e1 aarch64: Add OpenBSD runtime detection of dotprod and i8mm using sysctl
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-06-26 02:06:53 -04:00
Nuo Mi
23531c9776 avcodec/vvcdec: alf, support virtual boundaries
see https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9503377

passed files:
    GDR_A_ERICSSON_2.bit
    GDR_B_NOKIA_2.bit
    GDR_C_NOKIA_2.bit
    VIRTUAL_A_MediaTek_3.bit
    VIRTUAL_B_MediaTek_3.bit
2024-06-25 19:32:17 +08:00
Nuo Mi
3bac5ba861 avcodec/vvcdec: sao, support virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
17c8b63781 avcodec/vvcdec: deblock, support virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
80ded9cfe7 avcodec/vvcdec: ps, derive virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
8b3d1f1fb3 cbs_h266: add VVC_MAX_VBS for max num of virtual boundaries 2024-06-25 19:32:17 +08:00
Nuo Mi
fc731d8b39 avcodec/vvcdec: misc, constify ALFParams 2024-06-25 19:32:17 +08:00
Nuo Mi
9b532ace02 avcodec/vvcdec: misc, remove unused ALFParams.applied 2024-06-25 19:32:17 +08:00
Nuo Mi
98b6b90601 avcodec/vvcdec: refact out alf_get_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
45d0ba8313 avcodec/vvcdec: misc, reformat ff_vvc_sao_filter 2024-06-25 19:32:17 +08:00
Nuo Mi
a69b07dc79 avcodec/vvcdec: refact, fix naming convention of x0, y0 for sao
it's mismatched with the ff_vvc_sao_filter function declaration
2024-06-25 19:32:17 +08:00
Nuo Mi
ccf1d4172c avcodec/vvcdec: refact out sao_extends_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
200862b144 avcodec/vvcdec: refact out sao_get_edges 2024-06-25 19:32:17 +08:00
Nuo Mi
5b9320b209 avcodec/vvcdec: refact, unify ff_vvc_deblock_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
16e410aaac avcodec/vvcdec: misc, use POS to simplify filter code 2024-06-25 19:32:17 +08:00
Nuo Mi
a6ea542a34 avcodec/vvcdec: refact, unify {horizontal, vertical}_bs, {horizontal, vertical}_p, {horizontal, vertical}_q 2024-06-25 19:32:17 +08:00
Nuo Mi
cc89832d56 avcodec/vvcdec: refact, unify vvc_deblock_bs_chroma_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
0a5bbcf0f3 avcodec/vvcdec: refact, unify vvc_deblock_bs_luma_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
cb6538e9a1 avcodec/vvcdec: refact, unify vvc_deblock_subblock_bs_{horizontal, vertical} 2024-06-25 19:32:17 +08:00
Nuo Mi
0333b97414 checkasm/vvc_alf: ensure right and bottom boundaries are not overwritten by asm 2024-06-25 19:32:17 +08:00
Nuo Mi
6b0e6a98b5 x86/vvc_alf: avoid overwriting for non-16 aligned widths
Previously, the code allowed overwriting on 16-aligned blocks, which was suitable when there were
no picture's virtual boundaries because both CTU sizes and strides were 16-aligned. However, with
picture's virtual boundaries, each CTU is divided into four ALF blocks, leading to potential issues
with overwriting later CTUs.

In cases involving picture virtual boundaries, each ALF block is 8-pixel aligned.
For luma, we consistently ensure an 8-aligned width. For chroma in 4:2:0 format,
we need to account for a 4-aligned width.
2024-06-25 19:32:17 +08:00
Nuo Mi
1fa9f5b17f checkasm/vvc_alf: random select alf virtual boundaries position
A picture's virtual boundaries will split a CTU into 4 ALF blocks.
The ALF virtual boundary may cross or not cross a ALF block.
2024-06-25 19:32:17 +08:00
Nuo Mi
b82ef7c0ba checkasm/vvc_alf: only check the valid filter and classify sizes 2024-06-25 19:32:17 +08:00
James Almer
74035aaed7 avformat/matroskadec: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:11 -03:00
James Almer
f6b29c8773 avformat/mov: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:11 -03:00
James Almer
7c0ebb095d avcodec/mpeg12dec: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:10 -03:00
James Almer
e6baf4f384 avutil/stereo3d: add a new allocator function that returns a size
av_stereo3d_alloc() is not useful in scenarios where you need to know the
runtime size of AVStereo3D.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-25 00:01:05 -03:00
James Almer
1034296eac avformat/dump: print Stereo3D AVRationals as float
Same as every other rational printed in this file.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-24 20:00:14 -03:00
Timo Rothenpieler
6d4eba51f2 fftools/ffplay_renderer: use correct NULL value for Vulkan type 2024-06-25 00:19:03 +02:00
Lynne
dae12ddb2e
lavu/stereo3d: change the horizontal FOV field to a rational
This avoids hardcoding any implementation-specific limitiations as
part of the API, and allows for future expandability.

This also allows API users to more conveniently convert the
values into floats without hardcoding specific conversion constants.

The API was committed a few days ago, so changing this field now
is within the realms of acceptable.
2024-06-24 23:53:25 +02:00