Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 170ee738c6f19a9f81f398e2fa0752b9ac234cd4
https://github.com/WebKit/WebKit/commit/170ee738c6f19a9f81f398e2fa0752b9ac234cd4
Author: Sosuke Suzuki <[email protected]>
Date: 2026-07-15 (Wed, 15 Jul 2026)
Changed paths:
A JSTests/stress/temporal-duration-round-zero-length-nudge-window.js
M Source/JavaScriptCore/runtime/temporal/core/DurationArithmetic.cpp
Log Message:
-----------
[JSC] `Temporal.Duration` rounding divides by zero when a time zone
transition skips an entire day
https://bugs.webkit.org/show_bug.cgi?id=319465
Reviewed by Yusuke Suzuki.
When rounding a duration relative to a ZonedDateTime whose nudge window ends on
a
calendar day entirely skipped by a time zone transition (Pacific/Apia skipped
2011-12-30 when it crossed the date line), both window bounds in
NudgeToCalendarUnit
resolve to the same instant. Computing the progress fraction then divides by
zero:
x86_64 Release crashes with SIGFPE, arm64 Release returns Infinity or
self-inconsistent
values, and Debug hits the step 13 assertion. The assertion is known to be
violable in
the spec itself [1]; throw a RangeError instead, matching the observable
behavior of
@js-temporal/polyfill.
The bounds assertion after the ComputeNudgeWindow retry is violable the same
way, even
by ordinary one-hour DST transitions; remove it and keep computing, which
produces the
same result as the polyfill.
const relativeTo =
Temporal.ZonedDateTime.from('2012-01-01T12:00:00[Pacific/Apia]');
Temporal.Duration.from({ days: -1 }).total({ unit: 'days', relativeTo });
// SIGFPE on x86_64
[1]: https://github.com/tc39/proposal-temporal/issues/3310
* JSTests/stress/temporal-duration-round-zero-length-nudge-window.js: Added.
(shouldBe):
(shouldThrowRangeError):
(throw.new.Error):
* Source/JavaScriptCore/runtime/temporal/core/DurationArithmetic.cpp:
(JSC::TemporalCore::nudgeToCalendarUnit):
Canonical link: https://commits.webkit.org/317234@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications