]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/libx265: Fix integer overflow in computation of max and avg bitrate
authorLimin Wang <lance.lmwang@gmail.com>
Mon, 8 Jun 2020 11:51:33 +0000 (19:51 +0800)
committerLimin Wang <lance.lmwang@gmail.com>
Thu, 18 Jun 2020 23:14:46 +0000 (07:14 +0800)
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
libavcodec/libx265.c

index f560d7f62f85d8714abb4e5c0c32d307876da90c..686c205b6b5fba9115f3b2320a086240f2cd1437 100644 (file)
@@ -310,8 +310,8 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->buffer_size = ctx->params->rc.vbvBufferSize * 1000;
-    cpb_props->max_bitrate = ctx->params->rc.vbvMaxBitrate * 1000;
-    cpb_props->avg_bitrate = ctx->params->rc.bitrate       * 1000;
+    cpb_props->max_bitrate = ctx->params->rc.vbvMaxBitrate * 1000LL;
+    cpb_props->avg_bitrate = ctx->params->rc.bitrate       * 1000LL;
 
     if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
         ctx->params->bRepeatHeaders = 1;