ffmpeg | branch: master | Michael Niedermayer <[email protected]> | Sat 
May  5 20:08:36 2018 +0200| [62f07825ba11502b329716baddadea112c1837e5] | 
committer: Michael Niedermayer

avcodec/vp3: Check that there will be sufficient input for the coded fragments 
in unpack_superblocks()

Fixes: Timeout
Fixes: 
6292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4871218218926080

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>

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

 libavcodec/vp3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 1d83753314..2050090670 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -543,7 +543,10 @@ static int unpack_superblocks(Vp3DecodeContext *s, 
GetBitContext *gb)
                                          : s->y_superblock_count);
         int num_coded_frags = 0;
 
-        for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
+        for (i = sb_start; i < sb_end; i++) {
+            if (get_bits_left(gb) < ((s->total_num_coded_frags + 
num_coded_frags) >> 2)) {
+                return AVERROR_INVALIDDATA;
+            }
             /* iterate through all 16 fragments in a superblock */
             for (j = 0; j < 16; j++) {
                 /* if the fragment is in bounds, check its coding status */

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to