avcodec/takdec: Fix runtime error: signed integer overflow: 8192 * 524308 cannot...
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 16 May 2017 22:07:02 +0000 (00:07 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 21 May 2017 11:07:14 +0000 (13:07 +0200)
Fixes: 1630/clusterfuzz-testcase-minimized-6326111917047808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/takdec.c

index 9a13b8e..85ef566 100644 (file)
@@ -267,11 +267,11 @@ static int decode_segment(TAKDecContext *s, int8_t mode, int32_t *decoded, int l
     code = xcodes[mode - 1];
 
     for (i = 0; i < len; i++) {
-        int x = get_bits_long(gb, code.init);
+        unsigned x = get_bits_long(gb, code.init);
         if (x >= code.escape && get_bits1(gb)) {
             x |= 1 << code.init;
             if (x >= code.aescape) {
-                int scale = get_unary(gb, 1, 9);
+                unsigned scale = get_unary(gb, 1, 9);
                 if (scale == 9) {
                     int scale_bits = get_bits(gb, 3);
                     if (scale_bits > 0) {