summaryrefslogtreecommitdiff
path: root/libavcodec/huffyuv.c
diff options
context:
space:
mode:
authorMichael Kaufmann <michael@kaufmann.ch>2010-04-12 16:16:43 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2010-04-12 16:16:43 +0000
commit2818bdf22bb838c797b106e0897add6df4f88594 (patch)
tree32e7759a9c2fcd79064130f4336f89d5666ad2a5 /libavcodec/huffyuv.c
parent843c7aa8fbffcfd303181bcfecdd9f39b2c75d80 (diff)
Extradata length checks for Huffyuv.
Patch by Michael Kaufmann hallo $(name) dash $(surname) ch Originally committed as revision 22856 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/huffyuv.c')
-rw-r--r--libavcodec/huffyuv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 1a55abbe4c..0028da617b 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -452,6 +452,9 @@ s->bgr32=1;
if(s->version==2){
int method, interlace;
+ if (avctx->extradata_size < 4)
+ return -1;
+
method= ((uint8_t*)avctx->extradata)[0];
s->decorrelate= method&64 ? 1 : 0;
s->predictor= method&63;
@@ -462,7 +465,7 @@ s->bgr32=1;
s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
- if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0)
+ if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size-4) < 0)
return -1;
}else{
switch(avctx->bits_per_coded_sample&7){