1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avcodec/mjpegdec: bayer and rct are incompatible

Fixes: out of array read
Fixes: 49434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5208501080686592

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2022-08-13 22:47:31 +02:00
parent 928857099c
commit a44f5a5212
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -1092,6 +1092,10 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
return AVERROR_INVALIDDATA;
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
return AVERROR_INVALIDDATA;
if (s->bayer) {
if (s->rct || s->pegasus_rct)
return AVERROR_INVALIDDATA;
}
s->restart_count = s->restart_interval;
@ -1942,6 +1946,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
}
len -= 9;
if (s->bayer)
goto out;
if (s->got_picture)
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");