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

Side by Side Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 406263002: Make sure that begin time cannot be greater than (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moving checks into the parser Created 6 years, 5 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
« no previous file with comments | « LayoutTests/svg/animations/animateMotion-crash-with-large-begin-time-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 if (parse.endsWith('h')) 363 if (parse.endsWith('h'))
364 result = parse.left(parse.length() - 1).toDouble(&ok) * 60 * 60; 364 result = parse.left(parse.length() - 1).toDouble(&ok) * 60 * 60;
365 else if (parse.endsWith("min")) 365 else if (parse.endsWith("min"))
366 result = parse.left(parse.length() - 3).toDouble(&ok) * 60; 366 result = parse.left(parse.length() - 3).toDouble(&ok) * 60;
367 else if (parse.endsWith("ms")) 367 else if (parse.endsWith("ms"))
368 result = parse.left(parse.length() - 2).toDouble(&ok) / 1000; 368 result = parse.left(parse.length() - 2).toDouble(&ok) / 1000;
369 else if (parse.endsWith('s')) 369 else if (parse.endsWith('s'))
370 result = parse.left(parse.length() - 1).toDouble(&ok); 370 result = parse.left(parse.length() - 1).toDouble(&ok);
371 else 371 else
372 result = parse.toDouble(&ok); 372 result = parse.toDouble(&ok);
373 if (!ok) 373 if (!ok || !SMILTime(result).isFinite())
374 return SMILTime::unresolved(); 374 return SMILTime::unresolved();
375 return result; 375 return result;
376 } 376 }
377 377
378 SMILTime SVGSMILElement::parseClockValue(const String& data) 378 SMILTime SVGSMILElement::parseClockValue(const String& data)
379 { 379 {
380 if (data.isNull()) 380 if (data.isNull())
381 return SMILTime::unresolved(); 381 return SMILTime::unresolved();
382 382
383 String parse = data.stripWhiteSpace(); 383 String parse = data.stripWhiteSpace();
(...skipping 15 matching lines...) Expand all
399 return SMILTime::unresolved(); 399 return SMILTime::unresolved();
400 result += parse.substring(6).toDouble(&ok); 400 result += parse.substring(6).toDouble(&ok);
401 } else if (doublePointOne == 2 && doublePointTwo == kNotFound && parse.lengt h() >= 5) { 401 } else if (doublePointOne == 2 && doublePointTwo == kNotFound && parse.lengt h() >= 5) {
402 result += parse.substring(0, 2).toUIntStrict(&ok) * 60; 402 result += parse.substring(0, 2).toUIntStrict(&ok) * 60;
403 if (!ok) 403 if (!ok)
404 return SMILTime::unresolved(); 404 return SMILTime::unresolved();
405 result += parse.substring(3).toDouble(&ok); 405 result += parse.substring(3).toDouble(&ok);
406 } else 406 } else
407 return parseOffsetValue(parse); 407 return parseOffsetValue(parse);
408 408
409 if (!ok) 409 if (!ok || !SMILTime(result).isFinite())
410 return SMILTime::unresolved(); 410 return SMILTime::unresolved();
411 return result; 411 return result;
412 } 412 }
413 413
414 static void sortTimeList(Vector<SMILTimeWithOrigin>& timeList) 414 static void sortTimeList(Vector<SMILTimeWithOrigin>& timeList)
415 { 415 {
416 std::sort(timeList.begin(), timeList.end()); 416 std::sort(timeList.begin(), timeList.end());
417 } 417 }
418 418
419 bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) 419 bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd)
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 #if ENABLE(OILPAN) 1346 #if ENABLE(OILPAN)
1347 visitor->trace(m_targetElement); 1347 visitor->trace(m_targetElement);
1348 visitor->trace(m_timeContainer); 1348 visitor->trace(m_timeContainer);
1349 visitor->trace(m_conditions); 1349 visitor->trace(m_conditions);
1350 visitor->trace(m_syncBaseDependents); 1350 visitor->trace(m_syncBaseDependents);
1351 #endif 1351 #endif
1352 SVGElement::trace(visitor); 1352 SVGElement::trace(visitor);
1353 } 1353 }
1354 1354
1355 } 1355 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/animations/animateMotion-crash-with-large-begin-time-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698