[FFmpeg-cvslog] avcodec/mvha: Check remaining bits in VLC decode loop

Michael Niedermayer git at videolan.org
Mon Feb 10 00:34:16 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 15 22:13:14 2020 +0100| [cce37a22bc319c4b9e49d2b907841d9ec3f98c56] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cce37a22bc319c4b9e49d2b907841d9ec3f98c56
---

 libavcodec/mvha.c | 2 ++
 1 file changed, 2 insertions(+)

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);
 



More information about the ffmpeg-cvslog mailing list