changeset 31951:256b6b7d5e96

fix crash with un-commonly formated ASS files
author aurel
date Sun, 29 Aug 2010 11:27:00 +0000
parents 77b4e83fe42d
children beaf6bf007a5
files subreader.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Sun Aug 29 06:51:05 2010 +0000
+++ b/subreader.c	Sun Aug 29 11:27:00 2010 +0000
@@ -641,19 +641,20 @@
 
 	do {
 		if (!stream_read_line (st, line, LINE_LEN, utf16)) return NULL;
-	} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d,"
+	} while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d"
 			"%[^\n\r]", &nothing,
 			&hour1, &min1, &sec1, &hunsec1,
 			&hour2, &min2, &sec2, &hunsec2,
 			line3) < 9
 		 &&
-		 sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d,"
+		 sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d"
 			 "%[^\n\r]", &nothing,
 			 &hour1, &min1, &sec1, &hunsec1,
 			 &hour2, &min2, &sec2, &hunsec2,
 			 line3) < 9	    );
 
         line2=strchr(line3, ',');
+        if (!line2) return NULL;
 
         for (comma = 4; comma < max_comma; comma ++)
           {