aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-01 15:51:50 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-09 21:07:43 +0200
commit89409be50c212519f6313ad9144d7c5b17867728 (patch)
treead4c2f90d5d4dfafc91371ca5c10d62f88479936
parenta4bf9033c37897dbef39daaf073a8ecdb5c0888c (diff)
downloadffmpeg-89409be50c212519f6313ad9144d7c5b17867728.tar.gz
yopdec: check that palette fits in the packet
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit b6fdf8dea7aaf3cb9a979dce91f752c2ce3086a3) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/yop.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 40d9f7a818..21ccabd243 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -205,6 +205,11 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
+ if (avpkt->size < 4 + 3*s->num_pal_colors) {
+ av_log(avctx, AV_LOG_ERROR, "packet of size %d too small\n", avpkt->size);
+ return AVERROR_INVALIDDATA;
+ }
+
ret = avctx->get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");