diff mbox series

[FFmpeg-devel,3/3] avcodec/iff: Only write palette to plane 1 if its PAL8

Message ID 20210504210504.13396-3-michael@niedermayer.cc
State Accepted
Commit 216eb60b853e9a230c1238ab7d1c63d3fa892d34
Headers show
Series [FFmpeg-devel,1/3] avutil/tx: avoid negative left shifts
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 4, 2021, 9:05 p.m. UTC
Fixes: null pointer passed as argument 1, which is declared to never be null
Fixes: 33791/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5107575256383488.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/iff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index b5f04e7e16..6a4c466b44 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1847,7 +1847,8 @@  static int decode_frame(AVCodecContext *avctx,
                     buf += s->planesize;
                 }
             }
-            memcpy(frame->data[1], s->pal, 256 * 4);
+            if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
+                memcpy(frame->data[1], s->pal, 256 * 4);
         } else if (s->ham) {
             int i, count = 1 << s->ham;