fix: avoid span OOB in compute_logderivative_inverse for debug builds#22313
Draft
AztecBot wants to merge 1 commit intomerge-train/barretenbergfrom
Draft
fix: avoid span OOB in compute_logderivative_inverse for debug builds#22313AztecBot wants to merge 1 commit intomerge-train/barretenbergfrom
AztecBot wants to merge 1 commit intomerge-train/barretenbergfrom
Conversation
…ive computation In compute_logderivative_inverse, the multi-threaded path splits work by circuit_size, but the inverse polynomial may have fewer actual elements due to virtual zero padding. The batch_invert call accessed coeffs()[start] where start could exceed the polynomial's actual size, triggering a _GLIBCXX_DEBUG span bounds assertion in the nightly debug build. Fix: clamp start/end to the polynomial's actual data range before batch_invert. Virtual zero elements need no inversion.
bac7514 to
99d56de
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
Fixes
std::span::operator[]out-of-bounds assertion incompute_logderivative_inverse()that crashes the nightly debug build (_GLIBCXX_DEBUG).Two issues in
logderivative_library.hpp:size() = 0. Thebatch_invertpath unconditionally indexescoeffs()[start]even when the range is empty.circuit_size(2^21 for AVM) but the inverse polynomial can be much smaller, causing OOB span access in worker threads.Fix
coeffs()[start]/batch_invertwithif (start < end)to skip empty rangesinverse_polynomial.size()instead ofcircuit_sizeto bound the parallel work rangeTest plan
AvmVerifierTests.GoodPublicInputs— passes (was crashing)AvmVerifierTests.NegativeBadPublicInputs— passesAvmVerifierTests.ProofSizeMatchesComputedConstant— passesDetailed analysis: https://gist.github.com/AztecBot/7fd0fb327d2f1c0bae2fbd53d886b0f6
ClaudeBox log: https://claudebox.work/s/49b5d18ab43b5277?run=1
ClaudeBox log: https://claudebox.work/s/49b5d18ab43b5277?run=1