Skip to content

fix: remove UB in EndomorphismSplit test#21794

Merged
ludamad merged 1 commit into
nextfrom
claudebox/fix-endomorphism-split-test-ub
Mar 19, 2026
Merged

fix: remove UB in EndomorphismSplit test#21794
ludamad merged 1 commit into
nextfrom
claudebox/fix-endomorphism-split-test-ub

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

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

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Mar 19, 2026
@ludamad ludamad marked this pull request as ready for review March 19, 2026 15:16
@ludamad ludamad enabled auto-merge March 19, 2026 15:17
@AztecBot AztecBot force-pushed the claudebox/fix-endomorphism-split-test-ub branch from 62b4906 to 3276810 Compare March 19, 2026 15:51
## 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
@AztecBot AztecBot force-pushed the claudebox/fix-endomorphism-split-test-ub branch from 3276810 to 39f5746 Compare March 19, 2026 16:21
@ludamad ludamad added this pull request to the merge queue Mar 19, 2026
Merged via the queue into next with commit cee0613 Mar 19, 2026
14 of 18 checks passed
@ludamad ludamad deleted the claudebox/fix-endomorphism-split-test-ub branch March 19, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants