aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-10-30 15:12:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-05 18:29:12 +0100
commita190ca54f438db4d050ab0fce319fb41c3a85b46 (patch)
tree04dc2869802b828c2530a33084e3238432ee5bb9
parent6f1ef60d50cfb2d9f87a95d13d4190cbdc4d2718 (diff)
downloadffmpeg-a190ca54f438db4d050ab0fce319fb41c3a85b46.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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 5a98258191..2d348daca3 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -364,9 +364,16 @@ 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);
int ret;
+
+ if (pal_size != AVPALETTE_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
+ pal = NULL;
+ }
+
if (!context->palette)
context->palette = av_buffer_alloc(AVPALETTE_SIZE);
if (!context->palette) {