comparison subreader.c @ 31951:256b6b7d5e96

fix crash with un-commonly formated ASS files
author aurel
date Sun, 29 Aug 2010 11:27:00 +0000
parents c3775dbb8509
children c3b7fc7eb796
comparison
equal deleted inserted replaced
31950:77b4e83fe42d 31951:256b6b7d5e96
639 *line2; 639 *line2;
640 char *tmp; 640 char *tmp;
641 641
642 do { 642 do {
643 if (!stream_read_line (st, line, LINE_LEN, utf16)) return NULL; 643 if (!stream_read_line (st, line, LINE_LEN, utf16)) return NULL;
644 } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d," 644 } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d"
645 "%[^\n\r]", &nothing, 645 "%[^\n\r]", &nothing,
646 &hour1, &min1, &sec1, &hunsec1, 646 &hour1, &min1, &sec1, &hunsec1,
647 &hour2, &min2, &sec2, &hunsec2, 647 &hour2, &min2, &sec2, &hunsec2,
648 line3) < 9 648 line3) < 9
649 && 649 &&
650 sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d," 650 sscanf (line, "Dialogue: %d,%d:%d:%d.%d,%d:%d:%d.%d"
651 "%[^\n\r]", &nothing, 651 "%[^\n\r]", &nothing,
652 &hour1, &min1, &sec1, &hunsec1, 652 &hour1, &min1, &sec1, &hunsec1,
653 &hour2, &min2, &sec2, &hunsec2, 653 &hour2, &min2, &sec2, &hunsec2,
654 line3) < 9 ); 654 line3) < 9 );
655 655
656 line2=strchr(line3, ','); 656 line2=strchr(line3, ',');
657 if (!line2) return NULL;
657 658
658 for (comma = 4; comma < max_comma; comma ++) 659 for (comma = 4; comma < max_comma; comma ++)
659 { 660 {
660 tmp = line2; 661 tmp = line2;
661 if(!(tmp=strchr(++tmp, ','))) break; 662 if(!(tmp=strchr(++tmp, ','))) break;