[FFmpeg-cvslog] avcodec/rawdec: check for side data before checking its size

James Almer git at videolan.org
Sun Dec 4 22:27:40 EET 2016


ffmpeg | branch: release/3.0 | James Almer <jamrial at gmail.com> | Thu Nov  3 22:34:58 2016 -0300| [d111c9ce139c83edbf4f1e0ea22bb151b8da1547] | committer: James Almer

avcodec/rawdec: check for side data before checking its size

Fixes valgrind warnings about usage of uninitialized values.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 51e329918dc1826de7451541cb15bef3b9bfe138)

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

 Changelog           | 1 +
 libavcodec/rawdec.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 373a31b..cb97bac 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
 version 3.0.5:
+- avcodec/rawdec: check for side data before checking its size
 - avcodec/flacdec: Fix undefined shift in decode_subframe()
 - avcodec/get_bits: Fix get_sbits_long(0)
 - avformat/ffmdec: Check media type for chunks
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index f78190e..fbdf481 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -386,7 +386,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
         int pal_size;
         const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
                                                      &pal_size);
-        if (pal_size != AVPALETTE_SIZE) {
+        if (pal && pal_size != AVPALETTE_SIZE) {
             av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
             pal = NULL;
         }



More information about the ffmpeg-cvslog mailing list