From d111c9ce139c83edbf4f1e0ea22bb151b8da1547 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 3 Nov 2016 22:34:58 -0300 Subject: [PATCH] avcodec/rawdec: check for side data before checking its size Fixes valgrind warnings about usage of uninitialized values. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer (cherry picked from commit 51e329918dc1826de7451541cb15bef3b9bfe138) --- Changelog | 1 + libavcodec/rawdec.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 373a31b9a1..cb97baca1f 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 f78190ea01..fbdf4810fa 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; }