[FFmpeg-cvslog] avcodec/clearvideo: Check remaining input bits in P macro block loop

Michael Niedermayer git at videolan.org
Mon Jan 21 13:19:55 EET 2019


ffmpeg | branch: release/4.1 | Michael Niedermayer <michael at niedermayer.cc> | Thu Dec  6 01:19:37 2018 +0100| [228f17ced3bd394677f0421f462067a0f287ca8c] | committer: Michael Niedermayer

avcodec/clearvideo: Check remaining input bits in P macro block loop

Fixes: Timeout
Fixes: 11083/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CLEARVIDEO_fuzzer-5657180351496192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7aaab127bebb33003105a620736d6cae8c45a6e5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 0e3c772123..ad3012f7b7 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -570,6 +570,8 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
 
         for (j = 0; j < c->pmb_height; j++) {
             for (i = 0; i < c->pmb_width; i++) {
+                if (get_bits_left(&c->gb) <= 0)
+                    return AVERROR_INVALIDDATA;
                 if (get_bits1(&c->gb)) {
                     MV mv = mvi_predict(&c->mvi, i, j, zero_mv);
 



More information about the ffmpeg-cvslog mailing list