Skip to content

fix(patch_set): multi-byte char boundary panic - #76

Merged
bmwill merged 2 commits into
bmwill:masterfrom
weihanglo:multibyte-suffix
Apr 20, 2026
Merged

bmwill merged 2 commits into
bmwill:masterfrom
weihanglo:multibyte-suffix

Conversation

@weihanglo

Copy link
Copy Markdown
Contributor

The old byte-level reverse cmp could produce a suffix offset
inside a multi-byte UTF-8 character and panic.

Rewrite to track / positions during the reverse scan
and only split at those.
(/ is ASCII so no boundary check needed)

Found in fuzz test:
https://github.com/bmwill/diffy/actions/runs/24646265693/job/72059428553?pr=72

The old byte-level reverse cmp could produce a suffix offset
inside a multi-byte UTF-8 character and panic.

Rewrite to track `/` positions during the reverse scan
and only split at those.
(`/` is ASCII so no boundary check needed)
@bmwill
bmwill merged commit 8fdac0c into bmwill:master Apr 20, 2026
20 checks passed
@weihanglo
weihanglo deleted the multibyte-suffix branch April 20, 2026 16:01
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.

2 participants