1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avfilter/vf_stack: use ff_slice_pos() for the per-slice input range

Fixes: GIRN0tvt58WQ
Fixes: swarm-Signed-integer-overflow-in-process_slice-slice-computation-b29bec
Regression since: 631f7acc6c
Out of array read Replicated through UnModified FFmpeg with ASAN

Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
zhang xingxing
2026-10-15 04:46:24 +02:00
committed by michaelni
parent 5c0b32e0ae
commit 8a976f7275

View File

@@ -148,8 +148,8 @@ static int process_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
StackContext *s = ctx->priv;
AVFrame *out = arg;
AVFrame **in = s->frames;
const int start = (s->nb_inputs * job ) / nb_jobs;
const int end = (s->nb_inputs * (job+1)) / nb_jobs;
const int start = ff_slice_pos(s->nb_inputs, job, nb_jobs);
const int end = ff_slice_pos(s->nb_inputs, job + 1, nb_jobs);
for (int i = start; i < end; i++) {
StackItem *item = &s->items[i];