Skip to content

[5.7][stdlib] Duration: Fix rare overflow trap in Int128.multipliedFullWidth #59960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Jul 8, 2022

(cherry picked from #59959)

  • Explanation: Int128.multipliedFullWidth fails to account for an overflow case, which results in Duration.components trapping when the duration is a multiple of 512s.
  • Scope: Duration in the Standard Library.
  • Origination: Duration is a new type in Swift 5.7.
  • Risk: Low
  • Reviewers: @stephentyrone
  • Testing: New regression tests.
  • Issue: rdar://96362510

Int128.multipliedFullWidth fails to account for an overflow case, which lead `Duration.components` trapping when the duration is a multiple of 512s.

rdar://96362510
(cherry picked from commit 95a45db)

# Conflicts:
#	test/Concurrency/Runtime/clock.swift
@lorentey lorentey requested a review from a team as a code owner July 8, 2022 02:03
@lorentey
Copy link
Member Author

lorentey commented Jul 8, 2022

@swift-ci test

@lorentey lorentey merged commit d6e5805 into swiftlang:release/5.7 Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants