avcodec/takdec: Fix multiple runtime error: signed integer overflow: 637072 * 4096...
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 6 Jun 2017 14:01:16 +0000 (16:01 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 6 Jun 2017 14:54:50 +0000 (16:54 +0200)
Fixes: 2079/clusterfuzz-testcase-minimized-5345861779324928

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 512bd5a..7d3502b 100644 (file)
@@ -862,7 +862,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
 
             if (s->sample_shift[chan] > 0)
                 for (i = 0; i < s->nb_samples; i++)
-                    decoded[i] *= 1 << s->sample_shift[chan];
+                    decoded[i] *= 1U << s->sample_shift[chan];
         }
     }
 
@@ -904,7 +904,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
         for (chan = 0; chan < avctx->channels; chan++) {
             int32_t *samples = (int32_t *)frame->extended_data[chan];
             for (i = 0; i < s->nb_samples; i++)
-                samples[i] *= 1 << 8;
+                samples[i] *= 1U << 8;
         }
         break;
     }