Skip to content

Runtime: str.byte_at outside the string panics, as a List index does (#996) - #2687

Merged
ehartford merged 1 commit into
fix-999from
fix-996
Oct 25, 2026
Merged

ehartford merged 1 commit into
fix-999from
fix-996

Conversation

@ehartford

@ehartford ehartford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: str_byte_at_ref (rt/rt_core.w) returned 0 for an index below 0
or at or past the length: a NUL byte, an in-band answer to an
out-of-range read (D71: positional access panics out of range). The
comptime evaluator already refused the same call.

It panics "str.byte_at index out of bounds". Every byte_at in src/, lib/std
and build/ reads inside its string (checked by reading each of the ten).

Test: test/behavior/behav_996_str_byte_at_out_of_range_panics.w (exit 134;
the installed compiler prints 0 and exits 0).

Closes #996

@ehartford
ehartford added this pull request to stack #2689 October 25, 2026 23:07
@ehartford ehartford changed the title fix 996 Runtime: str.byte_at outside the string panics, as a List index does (#996) Oct 25, 2026
…996)

Root cause: str_byte_at_ref (rt/rt_core.w) returned 0 for an index below 0
or at or past the length: a NUL byte, an in-band answer to an
out-of-range read (D71: positional access panics out of range). The
comptime evaluator already refused the same call.

It panics "str.byte_at index out of bounds". Every byte_at in src/, lib/std
and build/ reads inside its string (checked by reading each of the ten).

Test: test/behavior/behav_996_str_byte_at_out_of_range_panics.w (exit 134;
the installed compiler prints 0 and exits 0).
@ehartford
ehartford marked this pull request as ready for review October 25, 2026 23:25
@ehartford
ehartford merged commit eff60eb into main Oct 25, 2026
@ehartford
ehartford deleted the fix-996 branch October 25, 2026 23:26
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.

runtime str.byte_at silently returns 0 on an out-of-bounds index

1 participant