Repository navigation
Conversation
…trings >= 4GiB There's two problems: - Some loops used `unsigned int` instead of `size_t`. - The 2*N-bit addition that is emulated using 2 N bit numbers has a bug: it first truncated the number to 32/64 bit and only then shifted. This resulted in the wrong length info stored inside the resulting hash.
Contributor
|
would be great to have the repro from #12936 in this PR? |
Girgias
approved these changes
Dec 12, 2023
Comment on lines
+283
to
+292
| unsigned int index, partLen; | ||
| size_t i; | ||
|
|
||
| /* Compute number of bytes mod 128 */ | ||
| index = (unsigned int) ((context->count[0] >> 3) & 0x7F); | ||
| /* Update number of bits */ | ||
| if ((context->count[0] += ((uint32_t) inputLen << 3)) < ((uint32_t) inputLen << 3)) { | ||
| context->count[1]++; | ||
| } | ||
| context->count[1] += ((uint32_t) inputLen >> 29); | ||
| context->count[1] += (uint32_t) (inputLen >> 29); |
Member
There was a problem hiding this comment.
Does it make sense for master to change those to use uint_least64_t ? As those should always be defined even on 32 bit where there is not a fixed width 64 bit number.
Member
Author
There was a problem hiding this comment.
For the counts right? Perhaps, although we have to be careful with endianness and the handling of the counts in the finalize step.
Member
There was a problem hiding this comment.
Yes, but I didn't think about endianness
Member
Author
I asked Ilija about it and we concluded that it will be bad for CI stability. |
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.
There's two problems:
unsigned intinstead ofsize_t.