diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-09-14 00:03:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-02-02 14:18:20 +0100 |
commit | 604e27a6140897bb02d9395c2f126138be3dd985 (patch) | |
tree | 26bfcdd20a5d6b3f6ac10b935ce199a5d1a1fb93 | |
parent | a1194166548dc6932fd5f7fb26b28c731dcf4c65 (diff) | |
download | ffmpeg-604e27a6140897bb02d9395c2f126138be3dd985.tar.gz |
avcodec/mv30: Check remaining mask in decode_inter()
Fixes: timeout (too long -> 4sec)
Fixes: 25129/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5642089713631232
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 142ae27b1d4d23b72396950ebaaeaca10ba600d9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mv30.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c index c83ba7ffbd..0dcfef23e0 100644 --- a/libavcodec/mv30.c +++ b/libavcodec/mv30.c @@ -531,8 +531,13 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, for (int x = 0; x < avctx->width; x += 16) { if (cnt >= 4) cnt = 0; - if (cnt == 0) + if (cnt == 0) { + if (get_bits_left(&mask) < 8) { + ret = AVERROR_INVALIDDATA; + goto fail; + } flags = get_bits(&mask, 8); + } dst[0] = frame->data[0] + linesize[0] * y + x; dst[1] = frame->data[0] + linesize[0] * y + x + 8; |