summaryrefslogtreecommitdiff
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-01 17:37:47 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-02 18:09:11 +0200
commitdaf92cc074c5e2ddd567016ac8b142cbd0add43c (patch)
treeedb2547fd5aa2076eeb4ac9d8660a9460482dc87 /libavcodec/vp3.c
parentfbaa395917e169c1ef0684c657c36126db1d63a4 (diff)
downloadffmpeg-daf92cc074c5e2ddd567016ac8b142cbd0add43c.tar.gz
avcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()
Fixes: Timeout (82sec -> 1sec) Fixes: 16411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-5166958151991296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 28ed0461c7..a2bd2ef07d 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -710,6 +710,8 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
has_partial = 0;
bit = get_bits1(gb);
for (i = 0; i < s->yuv_macroblock_count; i += current_run) {
+ if (get_bits_left(gb) <= 0)
+ return AVERROR_INVALIDDATA;
current_run = vp4_get_mb_count(s, gb);
if (current_run > s->yuv_macroblock_count - i)
return -1;
@@ -719,6 +721,8 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
}
if (has_partial) {
+ if (get_bits_left(gb) <= 0)
+ return AVERROR_INVALIDDATA;
bit = get_bits1(gb);
current_run = vp4_get_mb_count(s, gb);
for (i = 0; i < s->yuv_macroblock_count; i++) {