[FFmpeg-cvslog] avcodec/mjpegdec: Fix order of condition for pal8
Michael Niedermayer
git at videolan.org
Wed Jun 2 23:52:42 EEST 2021
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon May 10 21:30:35 2021 +0200| [06d23c6f3f72c66364f6f0d2ab2eeac55daab6a8] | committer: Michael Niedermayer
avcodec/mjpegdec: Fix order of condition for pal8
Fixes: out of array access
Fixes: 33960/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5052852809629696
Fixes: 34163/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-6123678099177472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06d23c6f3f72c66364f6f0d2ab2eeac55daab6a8
---
libavcodec/mjpegdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 500cd373bc..02a987fd0c 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -681,7 +681,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
} else if (s->nb_components != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
return AVERROR_PATCHWELCOME;
- } else if (s->palette_index && s->bits <= 8 || s->force_pal8)
+ } else if ((s->palette_index || s->force_pal8) && s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
else if (s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
More information about the ffmpeg-cvslog
mailing list