summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-08-13 22:47:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-25 13:51:50 +0200
commit0035e034c0c7c03a07c1504974254bc74275e15c (patch)
tree31f9a0345c3ab920bf714cffb63ec8ce1dcd32bf /libavcodec
parent9363a18e496745cd8b54dd7a7765cf34f4184a09 (diff)
downloadffmpeg-0035e034c0c7c03a07c1504974254bc74275e15c.tar.gz
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> (cherry picked from commit a44f5a521227adc7be2f78b411f56da1a4d98704) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index afb117cfc6..f85ebbc754 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1082,6 +1082,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;
@@ -1932,6 +1936,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");