Repository navigation
Conversation
GetMinimalFromIndices started its loop at sol.size() and read sol[32]. The value was shifted out of the 800-bit stream, so the output is unchanged, but the read was out of bounds (libc++ hardening aborts on it).
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.
Fixes #2151.
GetMinimalFromIndicesstarted its loop ati = sol.size()and so readsol[32], one element past the end. The loop now starts atsol.size() - 1.The output is unchanged; the stray element was shifted out of the 800-bit stream anyway.
Tested
GetIndicesFromMinimalround-trips every fixed result. Under_LIBCPP_HARDENING_MODE_DEBUGthe old version aborts at once (vector[] index out of bounds); the fixed one runs clean under ASan/UBSan too.OptimisedSolve) built with this change, input = 32 zero bytes, nonce = 0: the same solution as before (one solution, 5 min on an M5 Pro).equihash_test,stratum_testpass (macOS arm64, RelWithDebInfo).