Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d11e792d060e255a5e6e72814f4fd9ba36d23c53
      
https://github.com/WebKit/WebKit/commit/d11e792d060e255a5e6e72814f4fd9ba36d23c53
  Author: Keita Nonaka <[email protected]>
  Date:   2025-06-03 (Tue, 03 Jun 2025)

  Changed paths:
    A JSTests/stress/date-timeClip-large-values.js
    M LayoutTests/js/date-timeClip-large-values-expected.txt
    M Source/JavaScriptCore/runtime/DatePrototype.cpp

  Log Message:
  -----------
  [JSC] Ensure `Date.prototype.setYear` Respects TimeClip Range by Guarding 
GregorianDateTime::years Overflow
https://bugs.webkit.org/show_bug.cgi?id=293692

Reviewed by Sosuke Suzuki.

TimeClip[1] function, as referenced in Date.prototype.setYear[2],
mentions that absolute value of time must not exceed 8.64E15 in milliseconds,
otherwise returns NaN. However, the current GregorianDateTime class represents
years member variable as int.
Therefore, if the years exceeds the maximum representable int,
date calculations may produce incorrect results.
This patch adds a safeguard to ensure that such overflows are prevented
to align the behavior with the TC39 spec.

[1]: https://tc39.es/ecma262/#sec-timeclip
[2]: https://tc39.es/ecma262/#sec-date.prototype.setyear

* LayoutTests/js/date-timeClip-large-values-expected.txt:
* Source/JavaScriptCore/runtime/DatePrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/295742@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to