fix: remove UB in EndomorphismSplit test#21794
Merged
Merged
Conversation
ludamad
approved these changes
Mar 19, 2026
62b4906 to
3276810
Compare
## Summary Removes undefined behavior from `ScalarMultiplicationTests/0.EndomorphismSplit` that was blocking all merge trains. The test used an aliased pointer trick where `k1` pointed to the input scalar itself and `k2` pointed to `scalar.data[2]` — a misaligned cast (violates `alignas(32)`) with out-of-bounds writes. This was surfaced by the field audit refactors in #20805 which changed from writing only 2 limbs to full 4-limb field assignments. The in-place aliasing is no longer needed since `split_into_endomorphism_scalars` now computes results into a local pair before writing back. Also removes an orphaned `#pragma GCC diagnostic pop` that had no matching `push`. ## Test plan - [ ] CI passes `srs_tests` (specifically `ScalarMultiplicationTests/0.EndomorphismSplit` on ARM64) ClaudeBox log: https://claudebox.work/s/309d7a82f94da3a0?run=2
3276810 to
39f5746
Compare
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.
Summary
Removes undefined behavior from
ScalarMultiplicationTests/0.EndomorphismSplitthat was blocking all merge trains.The test used an aliased pointer trick where
k1pointed to the input scalar itself andk2pointed toscalar.data[2]— a misaligned cast (violatesalignas(32)) with out-of-bounds writes. This was surfaced by the field audit refactors in #20805 which changed from writing only 2 limbs to full 4-limb field assignments. The in-place aliasing is no longer needed sincesplit_into_endomorphism_scalarsnow computes results into a local pair before writing back.Also removes an orphaned
#pragma GCC diagnostic popthat had no matchingpush.Test plan
srs_tests(specificallyScalarMultiplicationTests/0.EndomorphismSpliton ARM64)ClaudeBox log: https://claudebox.work/s/309d7a82f94da3a0?run=2