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

120447 Commits

Author SHA1 Message Date
aca41d3d93 swscale/output: Fix all bilinear integer overflows
Ticket11686 hinted at one of these overflows
this fixes them all

Issue in line 1325/1326 found by HAORAN FANG <xfanghaoran@gmail.com>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-02 16:26:33 +00:00
c44d237d80 swscale/output: Fix integer overflow with lum/chr/alpha filter
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-02 16:26:33 +00:00
f82748d5e0 lavc/vvc: Mark SPS used if multiple CLVSSs use it
Consider the following sequence of NALUs (with some PPSs etc. omitted
for brevity):
1. SPS (ID=0, content=A)
2. IDR (SPS=0)
3. IDR (SPS=0)
4. SPS (ID=0, content=B)
5. TRAIL (SPS=0)

When decode_sps is called for NALU 3., ps->sps_id_used is cleared as
IDRs are one way of forming a CLVSS.  Then, old_sps is non-NULL
containing the result of calling decode_sps for NALU 2.  We haven't
received any SPSs between NALUs 2. and 3., therefore old_sps and rsps
are identical and the function returns.  The issue is that, at this
point, ps->sps_id_used is still zero despite the SPS being used for IDR
3.  This results in the check for conflicting SPSs not working properly
when decode_sps is called for NALU 5., allowing prediction between
pictures with different SPSs and probably all sorts of other
shenanigans.

Patch addresses the problem outlined above by also setting
ps->sps_id_used in the early return case.
2025-08-02 15:04:39 +00:00
2e19e74a29 hwcontext_vulkan: transfer exclusive images to correct queue family in drm->vulkan mapping 2025-08-02 11:02:59 +03:00
bf79148cbb avcodec/proresenc_anatoliy: Remove support for grayscale flag
This results in the encoder producing empty scans for chroma planes,
which is illegal according to the ProRes SMPTE document.
2025-08-02 06:11:39 +00:00
a49108fd29 avcodec/proresdec: Remove grayscale hack
This was introduced in commit 9c43703, to support a codec "extension"
in the prores_aw encoder.
This removes the chroma fill loop, and instead performs the inverse
transform on null coefficients, which achieves the same result and
fixes an off-by-one in the chroma values produced.

Updated test to reflect this change.
2025-08-02 06:11:39 +00:00
2b522f537f avformat/mov: add extra sanity checks before setting the primary extradata
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-01 19:35:43 +00:00
c6b3aae0ee avfilter/vf_scale_d3d11: remove unused variable 2025-08-01 20:49:57 +02:00
6115f03939 avcodec/mfenc: remove unused variables 2025-08-01 20:49:57 +02:00
e5275dbc96 avcodec/mfenc: fix compilation on modern gcc/clang 2025-08-01 20:49:57 +02:00
18174cbae8 forgejo/workflows: add compile-only test for win64 2025-08-01 20:49:57 +02:00
9aed7383bd avformat/movenc: look for the Intra profile flag before assuming a stream is AVC-Intra
Fixes issue #20018.

Note that Codec Descriptors are not written for all these ai** codec tags, and no
considerations were ever made to ensure parameter sets are present in muxed packets.
Their usage may result in unplayable files if parameter sets are only available
in extradata (Default behavior for x264 encoding when combined with this muxer).

Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-01 14:53:17 +00:00
ab73bd94a3 avcodec/sanm: Checks related to negative left/top
Fixes: 423673969/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5466731806261248
Fixes: out of array access

Reviewed-by: Manuel Lauss <manuel.lauss@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-01 16:39:07 +02:00
b849ac006b avcodec/mpegvideo_dec: Fix lowres=3 field select interlaced mpeg4 frame
Fixes: out of array read in the chroma plane
Fixes: 428034092/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_DEC_fuzzer-5582608941776896.test

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-01 01:41:26 +02:00
2d64d1129f forgejo/workflows: only upload cache if key changed 2025-07-31 22:57:35 +00:00
901e23675b forgejo/workflows: enable gpl, nonfree and memory poisoning
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-31 22:03:20 +00:00
1e5488951b avcodec/mfenc: propagate error codes properly 2025-07-31 21:07:51 +00:00
bd18a6a9e0 avfilter/scale_d3d11: cleanup return path using fail label 2025-07-31 21:07:51 +00:00
d56522c6eb avcodec/mfenc: add support for D3D11 input surfaces
Adds D3D11 input surface support to the MediaFoundation encoder (mfenc),
allowing direct encoding of GPU frames without readback to system memory.
This improves performance and compatibility when used alongside scale_d3d11.

Signed-off-by: Dash Santosh <dash.sathyanarayanan@multicorewareinc.com>
2025-07-31 21:07:51 +00:00
96821211c2 avfilter: add scale_d3d11 filter
This commit introduces a new hardware-accelerated video filter, scale_d3d11,
which performs scaling and format conversion using Direct3D 11. The filter enables
efficient GPU-based scaling and pixel format conversion (p010 to nv12), reducing
CPU overhead and latency in video pipelines.
2025-07-31 21:07:51 +00:00
2ddc3cbd98 avcodec/flacdsp: Fix integer-overflow in flac_lpc_33_c
This fix copies a couple of casts from surrounding functions.
See https://crbug.com/432528781 for stack trace details.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-31 20:25:15 +02:00
9d8469e431 avcodec/apv: align APV color format support with latest liboapv version
Signed-off-by: Dariusz Frankiewicz <d.frankiewic@samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-31 20:24:40 +02:00
03b9180fe3 avfilter/avfiltergraph: add logging for filter formats
There is no convenient way, from the command line, to figure out which
formats a filter actually supports. This commit changes that by adding a
log output, at debug level, to simply print the list of formats each filter
advertises on its links, before any negotiation.

Furthermore, we can use the exact same helper function to also print out the
corresponding filter links when there is an error during format negotiation.

We need to use AV_BRINT_SIZE_UNLIMITED because the default format list for
filters like vf_scale is about 1700 characters long, significantly larger than
the the 1 kB default buffer.
2025-07-31 12:35:32 +00:00
1a61db9797 avformat/file: add missing null check in Android content resolver
openFileDescriptor() can return null in certain error conditions.

Signed-off-by: sfan5 <sfan5@live.de>
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 19:54:58 +08:00
2a49d05d1a avfilter/vf_vibrance: Update default value of rlum/blum
Fix #9195

It looks like vf_vibrance.c is similar to
https://github.com/zachsaw/RenderScripts/blob/master/RenderScripts/ImageProcessingShaders/SweetFX/Vibrance.hlsl
and
https://github.com/kevinlekiller/kwin-effect-shaders_shaders/blob/main/Vibrance.frag
Originall written by Christian Cann Schuldt Jensen ~ CeeJay.dk.

They use same matrix coeff.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 19:51:23 +08:00
b7946098b1 swscale/alphablend: don't overread alpha plane on subsampled odd size
This function overreads the input plane for odd dimensions, because the
chroma plane is always rounded up, which means (xy << subsample) + 1 exceeds
the actual alpha plane size.

To verify:
  valgrind ffmpeg -pix_fmt yuva420p -f lavfi -i color -vf \
  "scale=1x1,format=yuva420p,scale=alphablend=uniform_color,format=yuv420p \
  -vframes 1 -f null -

Fixes: https://trac.ffmpeg.org/ticket/11692
2025-07-31 11:32:20 +00:00
119d127d05 lavu/spherical: Add support for Spherical Immersive type 2025-07-31 10:58:36 +02:00
c275f3bfa1 mov: Export frame packing information from pack box 2025-07-31 10:49:27 +02:00
eade338656 libavformat/mov.c: Fix "statement will never be executed" warning
That occurs when H261, H263, and MPEG4 decoders are disabled.

Signed-off-by: zhaozhenghang <15083277223@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-31 11:13:04 +08:00
1cbf7fc434 tests/fate/mov: add a test muxing multiple stsd entries
Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-30 16:48:14 -03:00
4eca8df8b8 avformat/movenc: support writing more than one STSD entry per track
If a packet contains new extradata within a side data entry, save for
specific cases it means the coded stream changed. If ignored, upon
demuxing every packet from then onwards may be undecodable.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-30 16:48:14 -03:00
306448756b avformat/movenc: allow storing more than one extradata buffer per track
This is in preparation for a following change

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-30 16:48:14 -03:00
eefa6de7d5 avformat/mov: export the correct initial extratada from samples with multiple stsd
The first sample in the stsc box may not refer to the first stsd entry.
This is the case in h264/thezerotheorem-cut.mp4, and as such the
fate-h264_redundant_pps-side_data test is updated accordingly.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-30 16:48:14 -03:00
a4a3b3bf54 fate: Add a missing ffprobe dependency for fate-filter-select-ffprobe
This fixes doing "make fate" without having done a plain "make"
before.
2025-07-30 19:33:30 +00:00
daee46ed7e Revert "avformat/tls_openssl: properly get new BIO index"
BIO_get_new_index() is static counter meant to get index for custom bio
type definition. As we can read in the documentation:

> Note that BIO_get_new_index() can only be used 127 times before it
> returns an error.

We cannot call it repeatedly, because it will fail eventually.

To my understanding the index is not needed in our use and we could
safely use BIO_TYPE_NONE. Documentation states:

> type can be set to either BIO_TYPE_NONE or via BIO_get_new_index() if
> a unique type is required for searching (See BIO_find_type(3))

We don't use any search related functions.

This reverts commit 816dad231f.
Fixes: https://github.com/mpv-player/mpv/issues/16589

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-30 02:56:12 +02:00
f09c834a7d avcodec/cbs_apv_syntax_template: Check tile_data_size
Fixes: heap-buffer-overflow
Fixes: 418421333/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APV_fuzzer-6592025183191040
Fixes: 418804929/clusterfuzz-testcase-minimized-ffmpeg_BSF_APV_METADATA_fuzzer-5773904646045696
Fixes: 420737045/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APV_fuzzer-5535272169439232

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-30 01:18:03 +02:00
ebcdba4c6b avformat/subfile: Initialize end on all cases
Fixes: use of uninitialized variable
Regression since: e29016a9de

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-30 01:18:03 +02:00
3ccd7d8c8e avcodec/sanm: Check decoded_size for old_codec48
Fixes: writing over the end of the array
Fixes: BIGSLEEP-434637586/payload

Regression since: b22ce90d42

Found-by: Google Big Sleep
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-30 01:18:02 +02:00
5f24c50890 amfenc: Fix for full PA queue
Fixes AMF_INPUT_FULL errors with pre-analysis (PA) enabled.
Added wait and poll encoder output to free up internal buffers
before submitting new frames.
Improves stability and performance by accounting for encoder and
analysis stage queue limits (incl. lookahead buffering).

Reproduce:
ffmpeg.exe -y -r 60 -f lavfi -i testsrc=rate=60:size=3840x2160
-t 10 -pix_fmt yuv420p -an -c:v av1_amf -preset:v high_quality
-profile:v main -quality:v high_quality -usage:v high_quality
2025-07-29 23:38:16 +02:00
cd33219558 avutil/hwcontext_amf: add device cache size
This change improves pipeline stability and reduces
dynamic GPU surface allocations when using AMF with copy_frame = 1.
This optimization has no negative effect.
2025-07-29 23:38:08 +02:00
0cc46f1f59 avfilter/af_afade: rework crossfade activate logic
The new logic should be easier to follow.

It also uses ff_inlink_consume_frame() for all simple passthrough operations
making custom get_audio_buffer callback unnecessary.

Fate changes are because the new logic does not repacketize input audio up
until the crossfade. Content is the same.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-29 22:10:05 +02:00
84d831ec58 avfilter/af_afade: fix check_input for empty streams
Use ff_outlink_get_status directly to get pending EOF state.

Fixes assertion failure with:
ffmpeg -lavfi "sine=f=1000:d=2[a];sine=f=440:d=2,atrim=end=0[b];[a][b]acrossfade=d=1" -f framecrc -
ffmpeg -lavfi "sine=f=1000:d=2,atrim=end=0[a];sine=f=440:d=2[b];[a][b]acrossfade=d=1" -f framecrc -

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-29 22:10:05 +02:00
4be21b9399 avfilter/af_afade: factorize functions generating frames
No change in functionality.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-29 22:10:05 +02:00
944329f8fd avfilter/trim: consume all available frames and avoid activate reschedule
There is no benefit in delaying processing all available frames.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-07-29 22:10:05 +02:00
7c5319e692 lavc/vvc: Add max parameter to kth_order_egk_decode
Prior to this patch, kth_order_egk_decode could read arbitrarily
large values which then overflowed and caused various issues.
Patch fixes this by making kth_order_egk_decode falliable,
requiring the caller to specify an upper bound and returning an
error if the read value would exceed that bound.

This patch resolves the same issue as
eb52251c0a, but I think this is the proper
fix as it also addresses issues with syntax elements besides
ff_vvc_num_signalled_palette_entries.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-07-28 20:46:10 +01:00
ce172bc362 lavc/vvc: Don't discard palette_subblock_data return code
Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-07-28 20:45:45 +01:00
a408b74977 avformat/dhav: Remove end_ prefix from variable names
The end_ prefix is confusing and may have contributed the mixup
fixed in the previous commit

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-28 19:29:52 +02:00
33ae6cda71 avformat/dhav: fix reference point mixup
Fixes: reading the duration from before the start of the allocated buffer.

Regression since: 36ec9217e6

Fixes: BIGSLEEP-433513232/test

Found-by: Google Big Sleep
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-28 19:29:52 +02:00
15cec71665 checkasm/h264dsp: Fix stack-buffer-overflow, effective-type violations
Also ensure that the dst buffers are not too big
(they had the right size for >8 bit depths and were therefore
too big for eight bit, letting potential buffer overflows
in the eight bit version go undetected).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-28 19:29:51 +02:00
3afae0f440 avcodec/sanm: Check w, h for subversion < 2
Fixes: 410609432/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-4935159201988608
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-28 19:28:13 +02:00