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

Michael Niedermayer git at videolan.org
Wed Sep 8 22:42:18 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Tue May  4 22:52:41 2021 +0200| [b01534293e40487816ec08d4b2128df61f5b859a] | committer: Michael Niedermayer

avcodec/iff: Only write palette to plane 1 if its PAL8

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 at niedermayer.cc>
(cherry picked from commit 216eb60b853e9a230c1238ab7d1c63d3fa892d34)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b01534293e40487816ec08d4b2128df61f5b859a
---

 libavcodec/iff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 79f6215c77..76d3696bb3 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1848,7 +1848,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;
 



More information about the ffmpeg-cvslog mailing list