Commit Graph
12594 Commits
Author SHA1 Message Date
Michael Niedermayer 946fcce07b Update for 9.0.2
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-18 01:19:50 +02:00
Michael Niedermayer eb33250528 avfilter/vf_decimate: reject blocks smaller than one chroma sample
Fixes: out of array access
Fixes: division by zero
Fixes: vdfZuLhrGLdR
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 590fb407b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-18 00:51:27 +02:00
Michael Niedermayer 356fef62b4 avfilter/vf_colorconstancy: free only allocated buffers on setup failure
Fixes: invalid free on allocation failure
Fixes: BvbItG8H5bk7
Found-by: zhang xingxing
(cherry picked from commit 432679772a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-17 01:30:44 +02:00
Michael Niedermayer b47d79d4d5 avfilter/vf_uspp: Fix qpcount
Fixes: division by zero
Fixes: tiny_16x8.h264
Fixes: W9IyRhjCcQxd
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2c05ce65e1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-17 01:30:43 +02:00
Yongqiang Tian 6f45c7392c avfilter/f_metadata: avoid overread on long formatted output
vsnprintf() returns the number of characters that would have been written
when its output is truncated. Passing that value to avio_write() makes it
read beyond the 128-byte stack buffer for long metadata values.

Use avio_vprintf() to write the complete formatted string without the fixed
intermediate buffer.

Fixes: b0159af6bc
Signed-off-by: Yongqiang Tian <yqtian668@gmail.com>
(cherry picked from commit fd625f452c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-17 01:30:42 +02:00
Ayoub Nabil Boubagrat b7d8e10e61 avfilter/acrossover: reject non-finite parameters
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 0ba7514f99)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-04 21:54:00 +02:00
Ayoub Nabil Boubagrat ea68d02c47 avfilter/aiir: reject non-finite parameters
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 1d49dc80a9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-04 21:54:00 +02:00
Ayoub Nabil Boubagrat e00134132e avfilter/firequalizer: reject overflowing delays
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 31e92a56ca)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-04 21:54:00 +02:00
Ayoub Nabil Boubagrat 9fa9960cea avfilter/aecho: reject non-finite delays and decays
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
(cherry picked from commit 71f9ea2d84)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-04 21:53:59 +02:00
Hao Chen e32d862f13 avfilter/aarch64/vf_bwdif_init: Fix stride bound check
Fix stride condition when bounding w.

Signed-off-by: Hao Chen <haochenc@google.com>
(cherry picked from commit d9ed77cb52)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-04 21:53:59 +02:00
Michael Niedermayer 2e41be62b7 Bump for 9.0.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-12 05:22:39 +02:00
Michael Niedermayer be329d65d5 avfilter/spectrumsynth: negotiate one pixel format for both inputs
Fixes: out of array access
Fixes: ndSS0e433gq
Found-by: Eunsoo Kim, Microsoft FORGE Labs
(cherry picked from commit 4d896a22dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-12 04:52:01 +02:00
Michael Niedermayer 3fbb956082 avfilter/afir: bound the crossfades by the samples of the input frame
Fixes: ffmpeg -i tail.wav -i ir.wav -filter_complex "[0][1]afir=dry=1:wet=1:enable='lte(t,0.5)'" -f null -

Fixes: out of array access
Fixes: uQcNui1HxUqe
Regression since: 1835f884b7
Found-by: Eunsoo Kim, Microsoft FORGE Labs

(cherry picked from commit a681001244)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-12 04:52:01 +02:00
iSold Leo 9989a953fe avfilter/af_pan: check the id of named input channels before use
parse_channel_name() only rejects negative values on the named channel
path, while the numbered "c%d" path also checks against MAX_CHANNELS.
av_channel_from_string() accepts UNSD (512), UNK (768) and AMBI (1024),
and the id was then used directly to index used_in_ch[MAX_CHANNELS] on
the stack and pan->gain[out_ch_id][in_ch_id].

Before this change:

  ffmpeg -f lavfi -i "anullsrc=cl=stereo" -af "pan=stereo|FL=AMBI" -f null -
  af_pan.c:214:17: runtime error: index 1024 out of bounds for type 'int[64]'

The first out of bounds access is the read at the "reference twice"
check, so the symptom depends on what happens to be on the stack:
FL=UNK is silently accepted and produces silence, FL=UNSD reports
"Can not reference in channel 512 twice", and FL=AMBI aborts.

The check has to be at the caller and not in parse_channel_name(), which
is shared with the out channel path: there the named id is converted by
av_channel_layout_index_from_channel() into a layout index, so high ids
are legitimately supported and "pan=AMBI|AMBI=FL" works.

AVERROR_PATCHWELCOME is used because these are valid AVChannel values
that af_pan cannot represent: for named input channels the gain matrix is
indexed by the raw id, and the renumbering loop in config_props() is
bounded by MAX_CHANNELS as well, so such a mapping never worked.

The in_ch_id < 0 half is currently unreachable and only kept for symmetry
with the out channel check above.

Regression since 1f96db959c, which dropped
the "channel_id >= MAX_CHANNELS" part of the check when converting to the
new channel layout API.

Reported-by: karnakarreddi
Fixes: #22963
Signed-off-by: iSold Leo <s@qwqlog.com>
(cherry picked from commit f02c4372ed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-12 04:51:58 +02:00
Kacper Michajłow 03d9533176 Revert "lavfi/bwdif: fix heap-buffer-overflow with small height videos"
This reverts commit 795bccdaf5.

The heap-buffer-overflow was a symptom of the >8 bit boundary
conditions bug fixed in the previous commit. This workaround is no
longer needed.

This restores spatial-only interpolation of the whole frame for the
first and last fields, instead of running the temporal edge filter
against cloned reference frames on the outermost lines. Because of that
first frame references are updated to pre-fix values.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 3cd408c2a6e5a7de8b6d641dedd12d523b94014c)
2026-08-08 21:46:50 +00:00
Kacper Michajłow dcf567a048 avfilter/vf_bwdif: fix line boundary checks for >8 bits content
The mrefs/prefs boundary conditions scaled the y limits by the number of
bytes per sample, even though the ref offsets are already expressed in
elements. For content deeper than 8 bits this clamped perfectly valid
in-bounds line taps.

Found by validating the libplacebo GPU port against this filter, which
matches exactly on 16-bit content everywhere except these lines.

This changes the output for >8 bit content on the affected lines.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 7d96c87a7382fed8d571748d6ed5c1869c192c31)
2026-08-08 21:46:49 +00:00
Raja-89 eebd95977f avfilter/dnn: fix async teardown race condition in all backends
When the filter graph is torn down early (e.g. at EOF with -frames:v),
the main thread calls dnn_free_model and destroys the request queue
while async inference threads may still be running. When a detached
thread finishes and tries to push its result back to the destroyed
queue, it triggers a segmentation fault.

Add ff_dnn_wait_requests() to dnn_backend_common which blocks
until all allocated request items (ctx->nireq) have been safely
returned to the request_queue. Call it from dnn_free_model in the
torch, tensorflow, openvino, and onnx backends before destroying the queue.

(cherry picked from commit b52c71e438)
Co-Authored-by: Fable 5
2026-08-02 06:24:00 +02:00
Zhao Zhili 79e64c80bf avfilter/vf_scale_cuda: fix non-scaling format conversion
A format-only conversion leaves the auto use_filters value unresolved.
Regression since 5d0748243f.

Fix issue #23737

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit c57660fb18)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 06:03:04 +02:00
Dan Dennedy 90243e3985 scale_d3d11: Fix hw_frame_ctx reference leak
This fixes #20995. The reference is taken twice and assigned to the same pointer (see above in the same function). Only the latter is needed.

(cherry picked from commit 66a8c37582)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 02:47:32 +02:00
Michael Niedermayer 3b962c40dd avfilter/af_arnndn: pad the DCT input buffers to the read length
Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
(cherry picked from commit e38b5d15bd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 02:47:31 +02:00
Kenan Alghythee 3257728c61 avfilter/vf_xpsnr: avoid a zero block size on small frames
Fixes: division by zero
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
(cherry picked from commit 06fd4fd0e7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 02:47:29 +02:00
Michael Niedermayer 107072ee9b avfilter/vf_lut3d: do not compute size*size before the size is validated
parse_dat(), parse_cube(), and parse_cinespace() multiply an untrusted LUT size
before allocate_3dlut() validates it, which can overflow int.
Use the validated lutsize2 computed by allocate_3dlut() instead.

Fixes: signed integer overflow
(cherry picked from commit 92cd5c9781)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 02:47:28 +02:00
Michael Niedermayer 62294b6a8a avfilter/vf_hqdn3d: support dynamic frame sizes
(cherry picked from commit 5d7112c60e)
2026-08-02 02:47:28 +02:00
Michael Niedermayer e3d0c719fd avfilter/vf_hqdn3d: reject unsupported frame parameter changes
Fixes: out of array access
Fixes: 9aj_hqdn3d_dynamic_res.mjpg / 9aj_generate_hqdn3d_dynamic_res_mjpg.py
Fixes: wWDsy2oDvMuR
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit f0f634b658)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-08-02 02:47:28 +02:00
Michael Niedermayer b3c7ebc1ed avfilter/vf_swaprect: size the temp row buffer for the widest plane
Fixes: out of array access
Fixes: 7aj_swaprect_odd17_nv12.nut / 7aj_generate_swaprect_odd17_nv12.py
Fixes: VRAXYvKtmKa8
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit a7e38b617b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:59 +02:00
Michael Niedermayer 30a52276f9 avfilter/vf_floodfill: remove unneeded variables
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f186c50cf5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:59 +02:00
Michael Niedermayer a20608d325 avfilter/vf_floodfill: size the point stack for the current frame
Fixes: out of array access
Fixes: 8aj_floodfill_dynamic_size.pgm / 8aj_generate_floodfill_dynamic_size_pgm.py
Fixes: 3MleMXjGZvu3
Found-by: Adrian Junge (vurlo) <adjun37@gmail.com>
(cherry picked from commit 24c322fdb2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:58 +02:00
Michael Niedermayer 989444060d avfilter/vf_lut3d: compute size2 after the 3DLUTSIZE directive
Fixes: out of array access
Fixes: lut3d_poc/poc_3dlut2.dat
Fixes: 6p0ahHBxreqG
Found-by: SecBuddyF - Tencent KeenLab
(cherry picked from commit 0089694c06)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:58 +02:00
Michael Niedermayer e6bcc30dcd avfilter/vf_v360: keep remap source coordinates in bounds
Two runtime paths could compute out-of-range source coordinates for
degenerate projection geometry, causing heap-buffer-overflow reads

Fixes: out of array read
Fixes: assertion failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a73d648f6e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:55 +02:00
Michael Niedermayer 85d7bb2280 avfilter/vf_v360: reject dimensions too small for the projection
Fixes: out of array read
Fixes: assertion failure
Fixes: mQzloVqnivHQ
Found-by: Anthony Hurtado
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b3712addc9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:55 +02:00
Michael Niedermayer c20d78c683 avfilter/vf_quirc: resize the quirc buffers when the input size changes
Fixes: out of array access
Fixes: JbvzNObhorBp
Fixes: 030e140145 (lavfi: add quirc filter)
Found-by: Adrian Junge (vurlo)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4da9812e25)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:53 +02:00
Pavel Kohout 2ec918330e avfilter/boxblur: reject pixel formats deeper than 16 bits
Fixes: heap buffer overflow
Fixes: CRufFb6TVikL
Fixes: dee7440531 (vf_boxblur: Templatize blur{8,16})
Found-by: Pavel Kohout (Aisle Research)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0dac41d2e5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:51 +02:00
Michael Niedermayer eaf524a746 avfilter/vf_removelogo: free the whole mask on allocation failure
Found-by: Ao Xijie
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9a01c1cb6a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:50 +02:00
Michael Niedermayer 4423d1b59e avfilter/af_adeclick: free transform contexts and buffers on error
Found-by: Ao Xijie
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 59a5090070)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:50 +02:00
Jiale Yao 8af6c71d96 avfilter/vf_vif: Fix out of array access with small dimensions
The hand written boundary mirroring reflected an out of range index only
once, which is insufficient when the image dimension is smaller than the
filter half width (filt_w/2 == 8). A 1x1 input made the index reach 8
and -7, reading out of the src[]/temp[] arrays. Use avpriv_mirror(),
which mirrors repeatedly and stays in range for any dimension.

Fixes: out of array access
Fixes: repro.sh
Fixes: HuQn51lLiVJX
Fixes: 38aea9b041 (avfilter: add vif filter)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 56309e476a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-21 22:59:48 +02:00
Lynne d124bfeada vf_libplacebo: add missing avstring.h include
Otherwise compilation fails due to vulkan.h no longer including it.

(cherry picked from commit 90436de5e1)
2026-07-14 00:14:28 +09:00
Lynne 062de19095 configure: remove libshaderc and libglslang support
All of it is now gone.

(cherry picked from commit 92f2e6374d)
2026-07-14 00:14:28 +09:00
Lynne ca089c35c4 vulkan: remove runtime shader compilation support
No longer needed.

(cherry picked from commit 9e9ac0dcd9)
2026-07-14 00:14:28 +09:00
Lynne 9b53c361ab vf_scale_vulkan: port to compile-time SPIR-V generation
Same functionality as before, but cleaner.

(cherry picked from commit 6219d4fdd1)
2026-07-14 00:14:28 +09:00
Kacper Michajłow b06c5316b7 avfilter/vsrc_gfxcapture_winrt: add missing system_error include
Fixes: error: no type named 'system_error' in namespace 'std'
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit c6498178bb)
2026-07-06 09:55:38 +00:00
Niklas Haas 901a25e0d1 avfilter/vf_scale_cuda: fix inverted downscaling check
Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 6baf561303)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:59 +02:00
Niklas Haas 74c735ab10 avfilter/vf_scale_cuda: allocate inter buffer with correct subsampling
Since the input and output format can differ (e.g. 444 -> 420), we need to
reference the correct subsampling for the partially applied filter.

Keep track of this in the CUDATex itself.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 01972b4f85)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:47 +02:00
Niklas Haas 316651a9ae avfilter/vf_scale_cuda: allocate intermediate buffer directly
Instead of going via an AVFrame at all. This will allow us to fix the
intermediate chroma plane size for split downscaling.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 420a9e90b8)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:37 +02:00
Niklas Haas 3a7097cfa7 avfilter/vf_scale_cuda: use persistent intermediate CUDATex
Instead of re-creating this object every frame.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit e79e9f06ba)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:26 +02:00
Niklas Haas f3f292929e avfilter/vf_scale_cuda: defer buffer allocation to setup_filters()
At this point, s->hwctx and CudaFunctions * are available.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 4289a29bb0)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:16 +02:00
Niklas Haas c5caacd845 avfilter/vf_scale_cuda: introduce CUDATex and mapping helper
I want to disentangle the internal logic from AVFrame, because some
intermediate states (e.g. for partially subsampled chroma with simultaneous
scaling) may not directly map to a valid AVPixelFormat.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit fef976b197)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:10:05 +02:00
Niklas Haas 480bf29af3 avfilter/vf_scale_cuda: add fail: label (cosmetic)
Make the next commit a bit easier to review.

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 61750318db)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:09:51 +02:00
Niklas Haas 9573519b01 avfilter/vf_scale_cuda: eliminate redundant context push/pop
This is already done by cudascale_filter_frame().

Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 0c3f04a97c)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 18:09:37 +02:00
Michael Niedermayer 47e9d68e20 Bump minor for release/9.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-26 02:43:34 +02:00
Diego de Souza df94900c98 avfilter/cuda: support P012/P212 and MSB 4:4:4 in scale/transpose/thumbnail
NVDEC and CUVID now output AV_PIX_FMT_P012 (12-bit 4:2:0), AV_PIX_FMT_P212
(12-bit 4:2:2) and AV_PIX_FMT_YUV444P10MSB / AV_PIX_FMT_YUV444P12MSB
(10/12-bit 4:4:4) for high-bit-depth content, but these CUDA filters
rejected the formats in their supported-format lists, breaking pipelines
such as "-hwaccel cuda ... -vf scale_cuda" on 12-bit input.

These formats use 16-bit sample storage, and the filters select their CUDA
kernel by byte-storage size and plane layout, not by the number of valid
bits, so they can reuse the existing 16-bit kernels:

- scale_cuda: P012/P212 -> "semiplanar16", YUV444P10MSB/YUV444P12MSB ->
  "planar16".
- transpose_cuda: the ushort/ushort2 kernels are chosen from the pixel
  descriptor (byte size + channel count); just allow the new formats.
- thumbnail_cuda: P012 reuses the P010/P016 path and the MSB 4:4:4 formats
  reuse the YUV444P16 path; P012 is added to the 4:2:0 chroma-histogram
  scaling as well. (thumbnail has no 4:2:2 path, so P212 is not added.)

The CUDA deinterlacers (bwdif_cuda, yadif_cuda) already accept any format
with <= 2 bytes per sample and <= 2 channels, so they need no change. The
8-bit-only filters (overlay_cuda, pad_cuda, bilateral_cuda, chromakey_cuda,
colorspace_cuda) do not support high bit depths and are left untouched.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2026-06-24 12:18:15 +00:00