Skip to content

Conversation

@Thaelz
Copy link

@Thaelz Thaelz commented Oct 9, 2025

Problem

The memcmp_consttime function will keep the difference by incrementing the variable sum. This is fairly safe on 32/64 bit systems. The overflow wouldn't happen before 16 millions bytes, which would be an abnormal hash size and probably detected beforehand. But, since the sum is typed as unsigned, this may lower the difficulty for an attacker to achieve this on 16 bits/8 bits systems. The overflow may be reached starting from 256 bytes, which would be a valid hash size.

Solution

As provided by the patch, we can mitigate this risk by switching to OR operation instead.

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.

1 participant