From 4fe755f6375aa2ad744a9b486dba6733c4a8c943 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Thu, 16 Nov 2017 10:41:32 +0100 Subject: [PATCH] codec: ttml: avoid fpe on large fractions --- 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 #include +#include #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; }