aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-31 19:20:10 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-19 02:40:54 +0100
commita26ac3cc69210f14f05db70dca61ae509d7883e2 (patch)
tree214b8d4a8c42819fb49c39dc2d4bb016a60780e5
parent8886e1228d1c47cb49212766f7ebf80797dfdaf4 (diff)
downloadffmpeg-a26ac3cc69210f14f05db70dca61ae509d7883e2.tar.gz
avcodec/huffyuvdec: Check input buffer size
Fixes: Timeout Fixes: 5487/clusterfuzz-testcase-4696837035393024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 08c220d26cff51ca2f6896b65aebfa3accc67290) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/huffyuvdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 7314519fca..47bca00010 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -915,6 +915,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVFrame *const p = data;
int table_size = 0, ret;
+ if (buf_size < (width * height + 7)/8)
+ return AVERROR_INVALIDDATA;
+
av_fast_padded_malloc(&s->bitstream_buffer,
&s->bitstream_buffer_size,
buf_size);