diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-10-30 15:12:12 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-23 13:15:16 +0200 |
commit | c9c3f1bc38413d2512eb5967f4b7a1e39fceb931 (patch) | |
tree | 4b30d8126d6932d8f87c129c092903add2b16212 | |
parent | e86c933544a222457d8c042a03011f8761665434 (diff) | |
download | ffmpeg-c9c3f1bc38413d2512eb5967f4b7a1e39fceb931.tar.gz |
avcodec/rawdec: Check side data size before use
Fixes out of array read
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 5f0bc0215a0f7099a2bcba5dced2e045e70fee61)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/rawdec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 568553923b..dd56680129 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -271,8 +271,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { + int pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, - NULL); + &pal_size); + if (pal_size != AVPALETTE_SIZE) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); + pal = NULL; + } if (pal) { av_buffer_unref(&context->palette); |