Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Side by Side Diff: Source/core/html/track/WebVTTParser.cpp

Issue 22304002: Crash when calling getCueAsHTML() on a TextTrackCue with empty text (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return BadCue; 321 return BadCue;
322 return Id; 322 return Id;
323 } 323 }
324 324
325 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(co nst String& text) 325 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(co nst String& text)
326 { 326 {
327 // Cue text processing based on 327 // Cue text processing based on
328 // 4.8.10.13.4 WebVTT cue text parsing rules and 328 // 4.8.10.13.4 WebVTT cue text parsing rules and
329 // 4.8.10.13.5 WebVTT cue text DOM construction rules. 329 // 4.8.10.13.5 WebVTT cue text DOM construction rules.
330 330
331 if (!text.length())
332 return 0;
acolwell GONE FROM CHROMIUM 2013/08/05 23:40:32 nit: Do you really need to jump though all the hoo
vcarbune.chromium 2013/08/09 18:47:26 Yes, you're right, it shouldn't go through everyth
333
334 ASSERT(m_scriptExecutionContext->isDocument()); 331 ASSERT(m_scriptExecutionContext->isDocument());
335 Document* document = toDocument(m_scriptExecutionContext); 332 Document* document = toDocument(m_scriptExecutionContext);
336 333
337 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); 334 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
338 m_currentNode = fragment; 335 m_currentNode = fragment;
339 m_tokenizer->reset(); 336 m_tokenizer->reset();
340 m_token.clear(); 337 m_token.clear();
341 338
342 m_languageStack.clear(); 339 m_languageStack.clear();
343 SegmentedString content(text); 340 SegmentedString content(text);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 unsigned oldPosition = *position; 559 unsigned oldPosition = *position;
563 while (*position < length && data[*position] != '\r' && data[*position] != ' \n') 560 while (*position < length && data[*position] != '\r' && data[*position] != ' \n')
564 (*position)++; 561 (*position)++;
565 String line = String::fromUTF8(data + oldPosition, *position - oldPosition); 562 String line = String::fromUTF8(data + oldPosition, *position - oldPosition);
566 skipLineTerminator(data, length, position); 563 skipLineTerminator(data, length, position);
567 return line; 564 return line;
568 } 565 }
569 566
570 } 567 }
571 568
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698