]> granicus.if.org Git - libass/commitdiff
string2timecode: don't truncate to int
authorOleg Oshmyan <chortos@inbox.lv>
Sun, 24 May 2015 22:00:38 +0000 (01:00 +0300)
committerOleg Oshmyan <chortos@inbox.lv>
Mon, 8 Jun 2015 21:17:48 +0000 (00:17 +0300)
The timecode is a long long, but it is computed as a product whose
all multiplicands are (unsigned) ints and so effectively has the value
of an (unsigned) int. Fix this, and use the full long long range,
by explicitly making one of the first two multiplicands a long long.

Found by Coverity Scan.

libass/ass.c

index 69dec8d37af070f84530a7d21eafc4a44cfdd927..01dd2eb4009184c5fdc75c3ad20cd788c4b02560 100644 (file)
@@ -188,7 +188,7 @@ static long long string2timecode(ASS_Library *library, char *p)
         ass_msg(library, MSGL_WARN, "Bad timestamp");
         return 0;
     }
-    tm = ((h * 60 + m) * 60 + s) * 1000 + ms * 10;
+    tm = ((h * 60LL + m) * 60 + s) * 1000 + ms * 10;
     return tm;
 }