summaryrefslogtreecommitdiff
path: root/libavcodec/mvha.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-15 22:13:14 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-02-09 23:33:18 +0100
commitcce37a22bc319c4b9e49d2b907841d9ec3f98c56 (patch)
treedb16b0d936267aca4a2b38f7e2b91ea5cc08edfb /libavcodec/mvha.c
parenta98eeb0c1e867238905ed095b48184f706adf328 (diff)
downloadffmpeg-cce37a22bc319c4b9e49d2b907841d9ec3f98c56.tar.gz
avcodec/mvha: Check remaining bits in VLC decode loop
Fixes: timeout (252sec -> 170msec) Fixes: 20023/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVHA_fuzzer-5681192565473280 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mvha.c')
-rw-r--r--libavcodec/mvha.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/mvha.c b/libavcodec/mvha.c
index 1ea3bb3d76..c603ef6975 100644
--- a/libavcodec/mvha.c
+++ b/libavcodec/mvha.c
@@ -233,6 +233,8 @@ static int decode_frame(AVCodecContext *avctx,
dst = frame->data[p] + (avctx->height - 1) * frame->linesize[p];
for (int y = 0; y < avctx->height; y++) {
+ if (get_bits_left(gb) < width)
+ return AVERROR_INVALIDDATA;
for (int x = 0; x < width; x++) {
int v = get_vlc2(gb, s->vlc.table, s->vlc.bits, 3);