[FFmpeg-devel] [PATCH 3/3] avcodec/jpeglsdec: force pal8 only once
Michael Niedermayer
michael at niedermayer.cc
Tue May 11 14:12:06 EEST 2021
Fixes: Infinite loop
Fixes: 33958/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-6590264069193728
Fixes: 33981/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEGLS_fuzzer-5343224173559808
Fixes: 33986/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-6598815122587648
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/jpeglsdec.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index c61cb14f49..32c0d2eb3f 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -118,9 +118,12 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
shift = 8 - s->avctx->bits_per_raw_sample;
}
- s->force_pal8 = 1;
- if (!pal)
+ s->force_pal8++;
+ if (!pal) {
+ if (s->force_pal8 > 1)
+ return AVERROR_INVALIDDATA;
return 1;
+ }
for (i=s->palette_index; i<=maxtab; i++) {
uint8_t k = i << shift;
--
2.17.1
More information about the ffmpeg-devel
mailing list