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>
This commit is contained in:
Michael Niedermayer authored and michaelni committed 2026-10-19 23:51:00 +00:00
1 parent cae0589065
commit 3f00282939
1 file changed
+4 -1
+4 -1
View File
@@ -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));