aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-10 21:36:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-06-02 22:35:36 +0200
commit864d1ef2fc88c300613a5a9f1465f98f3559110c (patch)
tree0a81db8e551d7b14b91e9f55f45722153a68b0ae
parent06d23c6f3f72c66364f6f0d2ab2eeac55daab6a8 (diff)
downloadffmpeg-864d1ef2fc88c300613a5a9f1465f98f3559110c.tar.gz
avcodec/jpeglsdec: force pal8 only once
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 Fixes: 34001/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMVJPEG_fuzzer-6171098111672320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeglsdec.c7
1 files 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;