Commit 3b5ce76b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: Restore non bayer checks in ljpeg_decode_rgb_scan()

Fixes: out of array write
Fixes: 17088/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5654877765632000

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2006e5cc
......@@ -1071,6 +1071,10 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
int resync_mb_x = 0;
int vpred[6];
if (!s->bayer && s->nb_components < 3)
return AVERROR_INVALIDDATA;
if (s->bayer && s->nb_components > 2)
return AVERROR_INVALIDDATA;
if (s->nb_components <= 0 || s->nb_components > 4)
return AVERROR_INVALIDDATA;
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment