Skip to content

fix: add bounds checking to array index assignment#252

Merged
cs01 merged 1 commit intomainfrom
fix/array-assignment-bounds-check
Mar 11, 2026
Merged

fix: add bounds checking to array index assignment#252
cs01 merged 1 commit intomainfrom
fix/array-assignment-bounds-check

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 11, 2026

Summary

  • Array index writes (arr[i] = val) now have the same bounds checking as reads — previously only reads had @__cs_bounds_check, writes could silently corrupt memory
  • Applies to all three array types: number[], string[], and object[]
  • Also refactored assignment index conversion to use shared toI32Index helper

Test plan

  • New assignment-bounds.ts fixture: verifies valid writes work and out-of-bounds write triggers error
  • npm run verify:quick passes (tests + self-hosting)

🤖 Generated with Claude Code

…ory writes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cs01 cs01 merged commit 2b0fc73 into main Mar 11, 2026
7 checks passed
@cs01 cs01 deleted the fix/array-assignment-bounds-check branch March 11, 2026 23:45
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