From 55753fc712622744093c8050b779c3d830c427cb Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 8 Dec 2022 23:49:33 +0100 Subject: [PATCH] avcodec/mjpegdec: check that component linesize is always valid --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 9b7465abe7..228d3077b9 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1512,7 +1512,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, "error y=%d x=%d\n", mb_y, mb_x); return AVERROR_INVALIDDATA; } - if (ptr) { + if (ptr && linesize[c]) { s->idsp.idct_put(ptr, linesize[c], s->block); if (s->bits & 7) shift_output(s, ptr, linesize[c]);