avformat/yuv4mpegen: Sanity check input packet frame dimensions

Fixes: out of array access if a filter-graph is used the injects changing dimensions

Found-by: Zhenpeng (Leo) Lin from depthfirst
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-02-10 00:40:52 +01:00
parent 9ee6136ece
commit b740b85872
+3
View File
@@ -197,6 +197,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
width = st->codecpar->width;
height = st->codecpar->height;
if (frame->width != width || frame->height != height)
return AVERROR(EINVAL);
desc = av_pix_fmt_desc_get(st->codecpar->format);
/* The following code presumes all planes to be non-interleaved. */