Skip to content

fix: array_index_needs_explicit_oob_check must consider flattened size - #13462

Open
asterite wants to merge 2 commits into
masterfrom
ab/zero-length-array-set-out-of-bounds
Open

fix: array_index_needs_explicit_oob_check must consider flattened size#13462
asterite wants to merge 2 commits into
masterfrom
ab/zero-length-array-set-out-of-bounds

Conversation

@asterite

@asterite asterite commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Problem Resolved

Resolves https://github.com/noir-lang/noir-claude/issues/1598

Summary of Changes

The check that considers whether an array can't have elements in it was slightly off.

User Documentation

Check one:

  • No user documentation needed.
  • Documented in docs/.
  • [For Experimental Features] Documentation tracking issue created:

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Changes to circuit sizes

Generated at commit: 710e8af7fb1a323bd2141ca856ce791160bd3bdc, compared to commit: 3c85016b5e2e6eade561eddbe4a903b5e82f6917

🧾 Summary (10% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
array_oob_regression_7965 +4 ❌ +12.90% +4 ❌ +0.14%
array_set_zero_length_element_brillig_input -1 ✅ -50.00% -2,743 ✅ -99.35%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
array_oob_regression_7965 35 (+4) +12.90% 2,843 (+4) +0.14%
array_set_zero_length_element_brillig_input 1 (-1) -50.00% 18 (-2,743) -99.35%

The implicit ACIR memory-op check reports the flattened index and size,
so composite-element arrays still need the explicit check to report the
logical index the user wrote.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@asterite
asterite requested a review from TomAFrench August 4, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant