[vlc-commits] packetizer: hevc: check for overflow in rate

Francois Cartegnie git at videolan.org
Wed Jul 19 11:31:02 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 19 10:53:38 2017 +0200| [f69c95e86f54c8341413403f7ea39449a1a134d1] | committer: Francois Cartegnie

packetizer: hevc: check for overflow in rate

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f69c95e86f54c8341413403f7ea39449a1a134d1
---

 modules/packetizer/hevc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 3e104ec859..3f7a36f771 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -43,6 +43,8 @@
 #include "hxxx_sei.h"
 #include "hxxx_common.h"
 
+#include <limits.h>
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -190,7 +192,8 @@ static int Open(vlc_object_t *p_this)
 
     /* Init timings */
     if( p_dec->fmt_in.video.i_frame_rate_base &&
-        p_dec->fmt_in.video.i_frame_rate )
+        p_dec->fmt_in.video.i_frame_rate &&
+        p_dec->fmt_in.video.i_frame_rate <= UINT_MAX / 2 )
         date_Init( &p_sys->dts, p_dec->fmt_in.video.i_frame_rate * 2,
                                 p_dec->fmt_in.video.i_frame_rate_base );
     else
@@ -465,7 +468,9 @@ static void ActivateSets(decoder_t *p_dec,
             {
                 p_dec->fmt_out.video.i_frame_rate = num;
                 p_dec->fmt_out.video.i_frame_rate_base = den;
-                if(p_sys->dts.i_divider_den != den && p_sys->dts.i_divider_num != 2 * num)
+                if(p_sys->dts.i_divider_den != den &&
+                   p_sys->dts.i_divider_num != 2 * num &&
+                   num <= UINT_MAX / 2)
                     date_Change(&p_sys->dts, 2 * num, den);
             }
         }



More information about the vlc-commits mailing list