Commit 3f00282939 for ffmpeg
commit 3f002829399c7bb5c0da57211601268ddd944838
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Oct 15 05:00:32 2026 +0200
avfilter/vf_stack: reject a grid with more than INT_MAX cells
Regression since: aa8905a1b1
NULL pointer dereference Replicated through UnModified FFmpeg with ASAN
Found during review of the fixes for the security report GIRN0tvt58WQ
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 19c4b2c147..04a335858b 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -116,8 +116,11 @@ static av_cold int init(AVFilterContext *ctx)
}
}
- if (is_grid)
+ if (is_grid) {
+ if (s->nb_grid_rows > INT_MAX / s->nb_grid_columns)
+ return AVERROR(EINVAL);
s->nb_inputs = s->nb_grid_rows * s->nb_grid_columns;
+ }
}
s->frames = av_calloc(s->nb_inputs, sizeof(*s->frames));