You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f79bfb
Browse filesBrowse the repository at this point in the historyBrowse files
fix: out-of-bounds index in ber_exp's comparison loop
The loop iterated `(0..64).step_by(8).rev()` — eight shifts — while indexing a
seven-byte buffer, so `random_bytes[7]` was read whenever the first seven bytes
all tied with the corresponding bytes of `z`. Drawn from the sampler's own RNG
that happens with probability about 2^-56, which is why it was never observed.
Driving the loop from the array instead of an independent range makes the bound
hold by construction.
No input-output change. The shifts remain 56 down to 8, exactly as before.
Adds a regression test that constructs the tying draw directly rather than
waiting for it. Pre-fix it panics with "index out of bounds: the len is 7 but
the index is 7"; post-fix the draw is rejected, which is what w == 0 means.
Full lib suite 169/169, including the 20 BerExp precision vectors — those would
have caught a shift that moved by one position.
Also: adhere to formatting and linter rules.
Co-Authored-By: Claude <[email protected]>
Co-authored-by: Conner Webber <[email protected]>
0 commit comments