Date.parse() doesn't properly handle input outside of ES Spec limits
authormsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2018 20:02:37 +0000 (20:02 +0000)
committermsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2018 20:02:37 +0000 (20:02 +0000)
commitc62edee43455749d95a87ecb62d88fd5cbc42e08
tree3f987b4f51c96722f718164108506dda60f4622b
parent60fe0b514be6c49296287b4d0dce8190825ebc7f
Date.parse() doesn't properly handle input outside of ES Spec limits
https://bugs.webkit.org/show_bug.cgi?id=185868

Reviewed by Mark Lam.

JSTests:

New test.

* stress/date-parse-ranges.js: Added.
(shouldBe):
(throw.new.Error):
(shouldBeNaN):

Source/WTF:

Clamped date creation to +/-100,000,000 days relative to midnight at the beginning
of 01 January, 1970 UTC as per ecma262/#sec-time-values-and-time-range and
ecma262/#sec-date-time-string-format.

* wtf/DateMath.cpp:
(WTF::ymdhmsToSeconds):
(WTF::parseES5DateFromNullTerminatedCharacters):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/date-parse-ranges.js [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/wtf/DateMath.cpp