[FFmpeg-cvslog] lavc: Make sure that the effective timebase would not overflow

Arttu Ylä-Outinen git at videolan.org
Wed Jan 27 20:41:03 CET 2016


ffmpeg | branch: master | Arttu Ylä-Outinen <arttu.yla-outinen at tut.fi> | Mon Jan 18 20:54:34 2016 +0100| [7486418683bd2477772e03aab573cf846c12fb0d] | committer: Luca Barbato

lavc: Make sure that the effective timebase would not overflow

In the unlikely situation the user decides to set ticks_per_frame
and timebase to a value large enough to overflow.

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavcodec/utils.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 29ba85f..e06ee66 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1049,6 +1049,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
         if (!avctx->rc_initial_buffer_occupancy)
             avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
+
+        if (avctx->ticks_per_frame &&
+            avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
+            av_log(avctx, AV_LOG_ERROR,
+                   "ticks_per_frame %d too large for the timebase %d/%d.",
+                   avctx->ticks_per_frame,
+                   avctx->time_base.num,
+                   avctx->time_base.den);
+            goto free_and_end;
+        }
     }
 
     if (avctx->codec->init && !(avctx->active_thread_type & FF_THREAD_FRAME)) {



More information about the ffmpeg-cvslog mailing list