avfilter: use ff_slice_pos() for per-slice boundary computation
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 21 Jun 2026 16:51:19 +0000 (18:51 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 21 Jun 2026 16:51:19 +0000 (18:51 +0200)
commit5b76394edad3da3930de8e3973a99d8c78a90605
tree7ba05d4abb23da092f10c7cce255c151f3598e9b
parent247ad1199feaae68c0224cace9407ef1a940f85b
avfilter: use ff_slice_pos() for per-slice boundary computation

This is a behavior preserving change for all non-overflowing cases.

Slice-based filters computed per-slice boundaries as (dim * jobnr) / nb_jobs
in int, which overflows for large dimensions with many slice threads,
yielding wrong slice bounds and out-of-array accesses. ff_slice_pos()
performs the multiplication in 64bit.

Backported to 4.4: applied the ff_slice_pos() conversion to the
dimension-based slices of the filters present in 4.4 (filters added after
the 4.4 branch are skipped), and added the required filters.h includes.
ff_slice_pos() itself is already present in 4.4. Channel-count based
slices (bounded, cannot overflow) are left unchanged.

(cherry picked from commit f7368f97b92a0afe8dc8368a4b6749704b740317)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
88 files changed:
libavfilter/af_asoftclip.c
libavfilter/af_crystalizer.c
libavfilter/vf_amplify.c
libavfilter/vf_atadenoise.c
libavfilter/vf_avgblur.c
libavfilter/vf_blackdetect.c
libavfilter/vf_blend.c
libavfilter/vf_bm3d.c
libavfilter/vf_bwdif.c
libavfilter/vf_cas.c
libavfilter/vf_chromakey.c
libavfilter/vf_chromanr.c
libavfilter/vf_chromashift.c
libavfilter/vf_colorbalance.c
libavfilter/vf_colorchannelmixer.c
libavfilter/vf_colorconstancy.c
libavfilter/vf_colorcontrast.c
libavfilter/vf_colorcorrect.c
libavfilter/vf_colorize.c
libavfilter/vf_colorkey.c
libavfilter/vf_colorlevels.c
libavfilter/vf_colormatrix.c
libavfilter/vf_colortemperature.c
libavfilter/vf_convolution.c
libavfilter/vf_convolve.c
libavfilter/vf_curves.c
libavfilter/vf_datascope.c
libavfilter/vf_dctdnoiz.c
libavfilter/vf_deband.c
libavfilter/vf_dedot.c
libavfilter/vf_despill.c
libavfilter/vf_epx.c
libavfilter/vf_estdif.c
libavfilter/vf_exposure.c
libavfilter/vf_fade.c
libavfilter/vf_gblur.c
libavfilter/vf_geq.c
libavfilter/vf_hqx.c
libavfilter/vf_identity.c
libavfilter/vf_lagfun.c
libavfilter/vf_lensfun.c
libavfilter/vf_limiter.c
libavfilter/vf_lumakey.c
libavfilter/vf_lut.c
libavfilter/vf_lut2.c
libavfilter/vf_lut3d.c
libavfilter/vf_maskedclamp.c
libavfilter/vf_maskedmerge.c
libavfilter/vf_maskedminmax.c
libavfilter/vf_maskedthreshold.c
libavfilter/vf_maskfun.c
libavfilter/vf_median.c
libavfilter/vf_mix.c
libavfilter/vf_monochrome.c
libavfilter/vf_neighbor.c
libavfilter/vf_nlmeans.c
libavfilter/vf_nnedi.c
libavfilter/vf_noise.c
libavfilter/vf_overlay.c
libavfilter/vf_photosensitivity.c
libavfilter/vf_premultiply.c
libavfilter/vf_pseudocolor.c
libavfilter/vf_psnr.c
libavfilter/vf_remap.c
libavfilter/vf_removegrain.c
libavfilter/vf_scroll.c
libavfilter/vf_selectivecolor.c
libavfilter/vf_shear.c
libavfilter/vf_shufflepixels.c
libavfilter/vf_signalstats.c
libavfilter/vf_ssim.c
libavfilter/vf_stereo3d.c
libavfilter/vf_super2xsai.c
libavfilter/vf_threshold.c
libavfilter/vf_tonemap.c
libavfilter/vf_transpose.c
libavfilter/vf_unsharp.c
libavfilter/vf_v360.c
libavfilter/vf_vibrance.c
libavfilter/vf_vif.c
libavfilter/vf_w3fdif.c
libavfilter/vf_waveform.c
libavfilter/vf_weave.c
libavfilter/vf_xbr.c
libavfilter/vf_xfade.c
libavfilter/vf_xmedian.c
libavfilter/vf_yadif.c
libavfilter/vf_yaepblur.c