Skip to content

fix(stdlib): trim_span backward scan usize underflow - #285

Merged
zaidejjo merged 1 commit into
devfrom
fix/trim-underflow
Oct 7, 2026
Merged

zaidejjo merged 1 commit into
devfrom
fix/trim-underflow

Conversation

@zaidejjo

@zaidejjo zaidejjo commented Oct 7, 2026

Copy link
Copy Markdown
Owner

ws_width_back guarded with end-N >= s, which wraps when end-s < N and panics indexing out of bounds (any 1-2 byte window ending in a byte >= 0x80, e.g. a lone é line). Rewrote as end-s >= N in Rust + C; added nb1 regression to str_find_test. e2e (VM) green locally; parity run in follow-up.

ws_width_back used end-N >= s guards that wrap when end-s < N,
indexing out of bounds (found via zcc offset-core parity: any
1-2 byte line ending in a high byte panicked). Rewrote guards as
end-s >= N on both backends; added nb1 regression to str_find_test.
@zaidejjo
zaidejjo merged commit f4ad683 into dev Oct 7, 2026
2 checks passed
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