Skip to content

Fixes overflow trap when creating DispatchTime objects with large upt… #311

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
merged 1 commit into from
Oct 16, 2017

Conversation

ktopley-apple
Copy link
Contributor

@ktopley-apple ktopley-apple commented Oct 11, 2017

…imeNanoseconds values.

(rdar://problem/34922683)

[related to change https://github.com/swiftlang/swift/pull/12387]

The change is in three parts:

The value UInt64.max passed to the DispatchTime initializer means DISPATCH_TIME_FOREVER and should not be scaled using the Mach timebase.
The scaling calculations need to detect overflow and clamp to UInt64.max if this occurs, making the value equal to DISPATCH_TIME_FOREVER
The getter for the uptimeNanoseconds also needs to be protected against overflow and return UInt64.max if it occurs.

@ktopley-apple
Copy link
Contributor Author

@swift-ci please test

@ktopley-apple ktopley-apple force-pushed the dispatch-timebase-overflow branch from abbe7d2 to 6aedc05 Compare October 12, 2017 15:14
@ktopley-apple
Copy link
Contributor Author

@swift-ci please test

@ktopley-apple ktopley-apple force-pushed the dispatch-timebase-overflow branch from 6aedc05 to 4195ac6 Compare October 16, 2017 14:12
@ktopley-apple
Copy link
Contributor Author

Squashed commits

@ktopley-apple ktopley-apple merged commit 12c9ca8 into master Oct 16, 2017
ktopley-apple added a commit that referenced this pull request Dec 6, 2018
Fixes overflow trap when creating DispatchTime objects with large upt…

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
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.

3 participants