Repository navigation
Conversation
"5000 fridays ago" computes 35000 days in seconds in an int. That is undefined,
and on LP64 the wrapped value then went through update_tm()'s unsigned long
argument, so the date came out about 40 years in the future.
The same unsigned long is 32 bits on Windows, where "8000 weeks ago" wrapped
before reaching update_tm(). Take the seconds as a git_time_t and do the
arithmetic in it.
approxidate_digit() also stored an unsigned long in an int. "4294967297 days
ago" meant "1 day ago", and "6442450944 years ago" subtracted INT_MIN from
tm_year. Ignore a number that doesn't fit, as is already done for one with too
much zero-padding.
These parsers are reachable from the revparse fuzzer through "@{...}".
This branch has not been deployed
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.
"5000 fridays ago"computes 35000 days in seconds in an int. On LP64 the wrapped value goes throughupdate_tm()'sunsigned longand the date comes out about 40 years in the future."4294967297 days ago"is cut down to"1 day ago", and"6442450944 years ago"subtracts INT_MIN fromtm_year. UBSan flags all of the overflows, and the revparse fuzzer can reach them through@{...}.update_tm()now takes agit_time_t, and a number that doesn't fit an int is ignored, as is already done for one with too much zero-padding.