Skip to content

fix overflow when truncating in submod2k - #251

Merged
mratsim merged 1 commit into
masterfrom
fuzz-8-overflow-trunc-submod2k
Jul 11, 2023
Merged

mratsim merged 1 commit into
masterfrom
fuzz-8-overflow-trunc-submod2k

Conversation

@mratsim

@mratsim mratsim commented Jul 10, 2023 •

Copy link
Copy Markdown
Owner

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

# 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
Copy Markdown
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
@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.

1 participant