avcodec/cllc: Check prefix
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 9 May 2017 17:38:46 +0000 (19:38 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 May 2017 15:32:51 +0000 (17:32 +0200)
Fixes: runtime error: left shift of 1610706944 by 1 places cannot be represented in type 'int'
Fixes: 1421/clusterfuzz-testcase-minimized-6239947507892224

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 62c5949beca2c95d6af5c74985467438d2295a66)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/cllc.c

index 24fa168..97d3ae4 100644 (file)
@@ -81,6 +81,10 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
 
             count++;
         }
+        if (prefix > (65535 - 256)/2) {
+            vlc->table = NULL;
+            return AVERROR_INVALIDDATA;
+        }
 
         prefix <<= 1;
     }