Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-10-30 17:12:12 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-10-31 03:19:16 +0300
commit5f0bc0215a0f7099a2bcba5dced2e045e70fee61 (patch)
tree802406c3e09468f0ba7d788f69c0932ca5786be1 /libavcodec/rawdec.c
parent0f64b6cd22411f574cbc75cab3b6db7dba023ed6 (diff)
avcodec/rawdec: Check side data size before use
Fixes out of array read Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1259577397..45cf27fa20 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) {