From 5603b5992d283cd91e76d26aab717c6bc5ed80fd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 5 Oct 2026 23:56:06 +0200 Subject: [PATCH] avfilter/vsrc_life: reject pattern files larger than INT_MAX bytes The prescan of the pattern file counts bytes, columns and lines in int, which overflows for a file larger than INT_MAX bytes. Found during triage/review of the security report WY5AA7zfuNDv --- libavfilter/vsrc_life.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index 65dc70d20b..db8750f469 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -238,6 +238,10 @@ static int init_pattern_from_file(AVFilterContext *ctx) 0, ctx)) < 0) return ret; av_freep(&life->filename); + if (life->file_bufsize > INT_MAX) { + av_log(ctx, AV_LOG_ERROR, "Pattern file too large\n"); + return AVERROR(EINVAL); + } /* prescan file to get the number of lines and the maximum width */ w = 0;