aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-10-30 15:12:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-11-17 12:47:40 +0100
commitaa896c182dae1f97be2c57ffcd1bdb8daec848f3 (patch)
tree198f4d334377f40be5fd3a9901ab38da4970d245 /libavcodec
parent956407b5df45c0125182e68c071b8ff4480520fe (diff)
downloadffmpeg-aa896c182dae1f97be2c57ffcd1bdb8daec848f3.tar.gz
avcodec/rscc: Check side data size before use
Fixes out of array read Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 0f64b6cd22411f574cbc75cab3b6db7dba023ed6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/rscc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index 7f280a9a97..7eb8776886 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -310,12 +310,15 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
frame->pict_type = AV_PICTURE_TYPE_P;
}
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+ int size;
const uint8_t *pal = av_packet_get_side_data(avpkt,
AV_PKT_DATA_PALETTE,
- NULL);
- if (pal) {
+ &size);
+ if (pal && size == AV_PKT_DATA_PALETTE) {
frame->palette_has_changed = 1;
memcpy(ctx->pal, pal, AVPALETTE_SIZE);
+ } else if (pal) {
+ av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
}
memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
}