[vlc-commits] codec: ttml: avoid fpe on large fractions

Francois Cartegnie git at videolan.org
Thu Nov 16 10:54:27 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 16 10:41:32 2017 +0100| [4fe755f6375aa2ad744a9b486dba6733c4a8c943] | committer: Francois Cartegnie

codec: ttml: avoid fpe on large fractions

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

 modules/codec/ttml/ttml.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/codec/ttml/ttml.c b/modules/codec/ttml/ttml.c
index c66a1214f2..8df1a7e354 100644
--- a/modules/codec/ttml/ttml.c
+++ b/modules/codec/ttml/ttml.c
@@ -29,6 +29,7 @@
 
 #include <assert.h>
 #include <stdlib.h>
+#include <limits.h>
 
 #include "ttml.h"
 
@@ -95,7 +96,7 @@ static tt_time_t tt_ParseTime( const char *s )
         if( c == '.' && d1 > 0 )
         {
             unsigned i_den = 1;
-            for( const char *p = strchr( s, '.' ) + 1; *p; p++ )
+            for( const char *p = strchr( s, '.' ) + 1; *p && (i_den < UINT_MAX / 10); p++ )
                 i_den *= 10;
             t.base += CLOCK_FREQ * d1 / i_den;
         }



More information about the vlc-commits mailing list