Commit f8b45742 authored by ulan@chromium.org's avatar ulan@chromium.org

Return an error when parsing invalid dates where a number immediately follows a word.

BUG=53209,126448
TEST=mjsunit/date-parse.js
R=rossberg@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10541138

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d946c310
......@@ -148,6 +148,9 @@ bool DateParser::Parse(Vector<Char> str,
} else {
// Garbage words are illegal if a number has been read.
if (has_read_number) return false;
// The first number has to be separated from garbage words by
// whitespace or other separators.
if (scanner.Peek().IsNumber()) return false;
}
} else if (token.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) {
// Parse UTC offset (only after UTC or time).
......
......@@ -287,6 +287,9 @@ for (var i = 0; i < 24 * 365 * 100; i += 150) {
var testCasesNegative = [
'May 25 2008 1:30 (PM)) UTC', // Bad unmatched ')' after number.
'May 25 2008 1:30( )AM (PM)', //
'a1', // Issue 126448, 53209.
'nasfdjklsfjoaifg1',
'x_2',
'May 25 2008 AAA (GMT)']; // Unknown word after number.
testCasesNegative.forEach(function (s) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment