avcodec/mpegvideo_parser: Fix integer overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Sep 2015 18:54:42 +0000 (20:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 2 Sep 2015 18:55:09 +0000 (20:55 +0200)
Fixes: signal_sigabrt_7ffff6ac8cc9_686_cov_1897408623_microsoft_new_way_to_shove_mpeg2_in_asf.dvr_ms

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mpegvideo_parser.c

index f5ac63f..1f74bfb 100644 (file)
@@ -159,11 +159,11 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
         av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions\n");
 
     if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && bit_rate) {
-        avctx->rc_max_rate = 400*bit_rate;
+        avctx->rc_max_rate = 400LL*bit_rate;
     }
     if (bit_rate &&
         ((avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && bit_rate != 0x3FFFF) || vbv_delay != 0xFFFF)) {
-        avctx->bit_rate = 400*bit_rate;
+        avctx->bit_rate = 400LL*bit_rate;
     }
 
     if (pix_fmt != AV_PIX_FMT_NONE) {