[vlc-commits] codec: ttml: fix overflow in time comparison

Francois Cartegnie git at videolan.org
Sat Apr 22 13:10:35 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Apr 22 13:08:39 2017 +0200| [4d85c74a5c071f227d09ac33f4c606a567b58d45] | committer: Francois Cartegnie

codec: ttml: fix overflow in time comparison

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

 modules/codec/ttml/ttml.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/ttml/ttml.h b/modules/codec/ttml/ttml.h
index 94263eda2d..51f41126f9 100644
--- a/modules/codec/ttml/ttml.h
+++ b/modules/codec/ttml/ttml.h
@@ -127,9 +127,12 @@ static inline mtime_t tt_time_Convert( const tt_time_t *t )
         return t->base + CLOCK_FREQ * t->frames / TT_FRAME_RATE;
 }
 
-static inline mtime_t tt_time_Compare( const tt_time_t *t1, const tt_time_t *t2 )
+static inline int tt_time_Compare( const tt_time_t *t1, const tt_time_t *t2 )
 {
-    return tt_time_Convert( t1 ) - tt_time_Convert( t2 );
+    if( tt_time_Convert( t1 ) < tt_time_Convert( t2 ) )
+        return -1;
+    else
+        return ( tt_time_Convert( t1 ) > tt_time_Convert( t2 ) );
 }
 
 static inline tt_time_t tt_time_Add( tt_time_t t1, tt_time_t t2 )



More information about the vlc-commits mailing list