[FFmpeg-cvslog] avcodec/qdrw: Fix null pointer dereference

Michael Niedermayer git at videolan.org
Sun Jun 18 17:33:18 EEST 2017


ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun  4 21:37:47 2017 +0200| [6f49b9a6881349601e6ab41a2eaedadc90dbb02d] | committer: Michael Niedermayer

avcodec/qdrw: Fix null pointer dereference

The RGB555 PACKBITSRGN case tries to read a palette, if such
palette is actually stored then it accesses a null pointer.
All 16bit samples i could find use DIRECTBITSRGN.

Fixes: 2065/clusterfuzz-testcase-minimized-6298930457346048

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 46b865ea9f86cbd12e1bf701913263c7932cccb0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/qdrw.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 828cfea3fd..2cf18869e1 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -55,6 +55,8 @@ static int parse_palette(AVCodecContext *avctx, GetByteContext *gbc,
             bytestream2_skip(gbc, 6);
             continue;
         }
+        if (avctx->pix_fmt != AV_PIX_FMT_PAL8)
+            return AVERROR_INVALIDDATA;
         r = bytestream2_get_byte(gbc);
         bytestream2_skip(gbc, 1);
         g = bytestream2_get_byte(gbc);
@@ -227,7 +229,9 @@ static int decode_frame(AVCodecContext *avctx,
             if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
                 return ret;
 
-            parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors);
+            ret = parse_palette(avctx, &gbc, (uint32_t *)p->data[1], colors);
+            if (ret < 0)
+                return ret;
             p->palette_has_changed = 1;
 
             /* jump to image data */



More information about the ffmpeg-cvslog mailing list