]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/iff: finetune the palette size check in the mask case
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 22 Jun 2019 19:17:52 +0000 (21:17 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 23 Jun 2019 08:51:16 +0000 (10:51 +0200)
Fixes: out of array access
Fixes: 15381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5668057826983936
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/iff.c

index b43bd507b368061a223ccf8aa53159c3a6c58dbd..4099d118e48e4592bfb522b3f6e7bff54bd52436 100644 (file)
@@ -1514,7 +1514,7 @@ static int decode_frame(AVCodecContext *avctx,
     buf_size -= bytestream2_tell(gb);
     desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 
-    if (!s->init && avctx->bits_per_coded_sample <= 8 &&
+    if (!s->init && avctx->bits_per_coded_sample <= 8 - (s->masking == MASK_HAS_MASK) &&
         avctx->pix_fmt == AV_PIX_FMT_PAL8) {
         if ((res = cmap_read_palette(avctx, (uint32_t *)frame->data[1])) < 0)
             return res;