comparison subreader.c @ 31279:0fc579d95340

Ensure the SAMI subtitle reader does not read more lines than we support.
author reimar
date Mon, 07 Jun 2010 18:53:20 +0000
parents 9667e45d6516
children 17db8e56de4c
comparison
equal deleted inserted replaced
31278:2d75e55e74bc 31279:0fc579d95340
161 161
162 case 3: /* get all text until '<' appears */ 162 case 3: /* get all text until '<' appears */
163 if (*s == '\0') break; 163 if (*s == '\0') break;
164 else if (!strncasecmp (s, "<br>", 4)) { 164 else if (!strncasecmp (s, "<br>", 4)) {
165 *p = '\0'; p = text; trail_space (text); 165 *p = '\0'; p = text; trail_space (text);
166 if (text[0] != '\0') 166 if (text[0] != '\0' && current->lines < SUB_MAX_TEXT)
167 current->text[current->lines++] = strdup (text); 167 current->text[current->lines++] = strdup (text);
168 s += 4; 168 s += 4;
169 } 169 }
170 else if ((*s == '{') && !sub_no_text_pp) { state = 5; ++s; continue; } 170 else if ((*s == '{') && !sub_no_text_pp) { state = 5; ++s; continue; }
171 else if (*s == '<') { state = 4; } 171 else if (*s == '<') { state = 4; }
242 242
243 // For the last subtitle 243 // For the last subtitle
244 if (current->end <= 0) { 244 if (current->end <= 0) {
245 current->end = current->start + sub_slacktime; 245 current->end = current->start + sub_slacktime;
246 *p = '\0'; trail_space (text); 246 *p = '\0'; trail_space (text);
247 if (text[0] != '\0') 247 if (text[0] != '\0' && current->lines < SUB_MAX_TEXT)
248 current->text[current->lines++] = strdup (text); 248 current->text[current->lines++] = strdup (text);
249 } 249 }
250 250
251 return current; 251 return current;
252 } 252 }