fix(acir): Do not read empty array under inactive predicates for various slice ops#10882
Merged
fix(acir): Do not read empty array under inactive predicates for various slice ops#10882
Conversation
TomAFrench
approved these changes
Dec 10, 2025
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: b822cd0 | Previous: 1eeaba1 | Ratio |
|---|---|---|---|
rollup-block-root |
1.97 s |
1.46 s |
1.35 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
5 tasks
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.
Description
Problem
Resolves https://github.com/noir-lang/noir/security/advisories/GHSA-mvh4-wv69-m9xh
Summary
I decided to implement a zero length check in ACIR gen for
SlicePopFront,SlicePopBack,SliceRemove, andSliceInsert.As per the comments under
ssa_gen/mod.rs:In order to have a defense in depth we should defend against empty slices in ACIR gen. ACIR gen does not want to rely on SSA gen checks to prevent ACIR memory read failures. Even so it has already been noted that ACIR memory ops ignore side effects variables by design so we need to prevent those operations which we know will fail in ACIR gen.
Changes:
has_zero_lengthto check if the slice block is empty after initializing the dynamic slice contents arrayis_constant_zero_lengthcheck from fix(acir-gen): Use the side effect variable inslice_pop_back#10455. The assertion was incorrect and needed to use the predicate as well (we just use the check included in this PR now). It is unlikely, but if we had a slice with a length known to be a constant zero under an invalid predicate this would have triggered unnecessary failuresexecution_successandexecution_failureas well as a couple ACIR gen unit test updatesAdditional Context
User Documentation
Check one:
PR Checklist
cargo fmton default settings.