[FFmpeg-cvslog] avcodec/utils: Fix signed integer overflow in rc_initial_buffer_occupancy initialization

Vitaly Buka git at videolan.org
Thu Oct 26 20:09:34 EEST 2017


ffmpeg | branch: release/3.0 | Vitaly Buka <vitalybuka-at-google.com at ffmpeg.org> | Sun Aug 20 11:56:47 2017 -0700| [616154a6a5352cbf3685f3bb494df8b5f4a8ebc0] | committer: Michael Niedermayer

avcodec/utils: Fix signed integer overflow in rc_initial_buffer_occupancy initialization

Signed integer overflow is undefined behavior.
Detected with clang and -fsanitize=signed-integer-overflow

Signed-off-by: Vitaly Buka <vitalybuka at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 8c2bb10ddfef1f151b9455d152c9aca91140a4b0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=616154a6a5352cbf3685f3bb494df8b5f4a8ebc0
---

 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d5e1cc87f5..72fd686e34 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1487,7 +1487,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
 
         if (!avctx->rc_initial_buffer_occupancy)
-            avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
+            avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
 
         if (avctx->ticks_per_frame && avctx->time_base.num &&
             avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {



More information about the ffmpeg-cvslog mailing list