diff mbox

[FFmpeg-devel] lavc/libx264: Cast bit_rate to int64_t to avoid an integer overflow

Message ID CAB0OVGqJDN-SQDjozM3ndY3RGr6atF-nATzR8pcbOSv4xxiHYw@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Aug. 10, 2019, 3:12 p.m. UTC
Hi!

Attached patch really fixes ticket #8071 for me.

Please comment, Carl Eugen
diff mbox

Patch

From e94234fb683b30518d96b1a36aba9e27c4cf9f1b Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sat, 10 Aug 2019 17:10:58 +0200
Subject: [PATCH] lavc/libx264: Cast bit_rate to int64_t to avoid an integer
 overflow.

Fixes ticket #8071.
---
 libavcodec/libx264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index dc4b4b100d..772fc614ac 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -898,7 +898,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
     if (avctx->max_b_frames < 0)
         avctx->max_b_frames = 0;
 
-    avctx->bit_rate = x4->params.rc.i_bitrate*1000;
+    avctx->bit_rate = (int64_t)x4->params.rc.i_bitrate*1000;
 
     x4->enc = x264_encoder_open(&x4->params);
     if (!x4->enc)
-- 
2.22.0