]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/takdec: Fix overflow with large sample rates
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 5 Oct 2019 17:52:53 +0000 (19:52 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Oct 2019 22:22:33 +0000 (00:22 +0200)
Fixes: signed integer overflow: 2147483647 + 511 cannot be represented in type 'int'
Fixes: 17899/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5719753322135552
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 4fb58255328358fd395abee3ed07c9640b724fd8..8ec87ab50971141c67158536523f87effeafff67 100644 (file)
@@ -176,8 +176,8 @@ static void set_sample_rate_params(AVCodecContext *avctx)
     } else {
         shift = 0;
     }
-    s->uval           = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << shift;
-    s->subframe_scale = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << 1;
+    s->uval           = FFALIGN(avctx->sample_rate + 511LL >> 9, 4) << shift;
+    s->subframe_scale = FFALIGN(avctx->sample_rate + 511LL >> 9, 4) << 1;
 }
 
 static av_cold int tak_decode_init(AVCodecContext *avctx)