Repository navigation
fix: reject a duration sum that wraps past 2^64 - #312
Merged
Merged
Conversation
Member
|
Thanks. Will review this later today |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #312 +/- ##
=======================================
Coverage 89.13% 89.13%
=======================================
Files 24 24
Lines 2926 2928 +2
=======================================
+ Hits 2608 2610 +2
Misses 317 317
Partials 1 1 ☔ View full report in Codecov by Harness. |
1<<63 ns plus 1<<63 ns wraps the uint64 total to 0, and that 0 passes the range check. ParseDuration returned 0s. Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
fredbi
force-pushed
the
fix/duration-sum-overflow
branch
from
October 2, 2026 19:40
5a1a8db to
3a19273
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ParseDuration("9223372036854775808ns 9223372036854775808ns")returned0s. Each token is1<<63nanoseconds. The uint64 sum wraps to 0, and 0 is not greater thanmaxUint64(1<<63), so the range check accepts it. The negative pair returned0sas well.A single
9223372036854775808nsstill errors.-9223372036854775808nsstays the minimum duration.9000000000000ms 9000000000000msstill errors.Red: parsed as
0s. Green:go test .