Skip to content
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

fix overflow when truncating in submod2k #251

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

mratsim
Copy link
Owner

@mratsim mratsim commented Jul 10, 2023

Fix @guidovranken fuzz failure 8

And separate stack hardening and sanitizers in test cases.
Enable stack hardening on all tests and sanitizers on modexp tests due to the frequent uses of allocStackArray


# We can compute (mod 2ʷ) with w >= k
# Hence we truncate the substraction to the next multiple of the word size
template trunc(x: openArray[SecretWord]): openArray[SecretWord] =
x.toOpenArray(0, k.int.wordsRequired()-1)
let truncHi = min(x.len, k.int.wordsRequired()) - 1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The absence of the min was the main bug

@mratsim mratsim merged commit 47b4f48 into master Jul 11, 2023
12 checks passed
@mratsim mratsim deleted the fuzz-8-overflow-trunc-submod2k branch July 11, 2023 12:31
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.

None yet

1 participant