[FFmpeg-cvslog] avcodec/rv40: Test remaining space in loop of get_dimension()

Michael Niedermayer git at videolan.org
Mon Dec 5 19:46:48 EET 2016


ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Nov 15 22:50:35 2016 +0100| [936d07ab2548a0a95f1e8f4dc2f350a360b81537] | committer: Michael Niedermayer

avcodec/rv40: Test remaining space in loop of get_dimension()

Fixes infinite loop
Fixes: 178/fuzz-3-ffmpeg_VIDEO_AV_CODEC_ID_RV40_fuzzer

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

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

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

diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index 465011a..e5ba215 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -109,6 +109,8 @@ static int get_dimension(GetBitContext *gb, const int *dim)
         val = dim[get_bits1(gb) - val];
     if(!val){
         do{
+            if (get_bits_left(gb) < 8)
+                return AVERROR_INVALIDDATA;
             t = get_bits(gb, 8);
             val += t << 2;
         }while(t == 0xFF);



More information about the ffmpeg-cvslog mailing list