]> granicus.if.org Git - libass/commitdiff
Make timestamp parsing more lenient
authorwm4 <wm4@nowhere>
Fri, 6 Mar 2015 12:28:48 +0000 (13:28 +0100)
committerwm4 <wm4@nowhere>
Fri, 6 Mar 2015 12:28:48 +0000 (13:28 +0100)
Fixes "[ARR] Musashi no Ken - 01 [AVC][5697986B].ssa", which has
timestamps like "00:02:30.85". It starts with 2 zeros instead of one,
which probably means it's an invalid file, but it's accepted by various
other parsers (VSFilter, MPlayer, vlc, ffmpeg).

libass/ass.c

index 04ce895f46ed4fb1513499cd63be2d3a44c82d21..594cca36e24ecb388bcbb161d1eb659a82d50db8 100644 (file)
@@ -183,7 +183,7 @@ static long long string2timecode(ASS_Library *library, char *p)
 {
     unsigned h, m, s, ms;
     long long tm;
-    int res = sscanf(p, "%1d:%2d:%2d.%2d", &h, &m, &s, &ms);
+    int res = sscanf(p, "%d:%d:%d.%d", &h, &m, &s, &ms);
     if (res < 4) {
         ass_msg(library, MSGL_WARN, "Bad timestamp");
         return 0;