Skip to content

fix(cargo): handle multi-byte chars in name range search#58

Merged
bug-ops merged 1 commit intomainfrom
fix/cargo-multibyte-panic
Feb 16, 2026
Merged

fix(cargo): handle multi-byte chars in name range search#58
bug-ops merged 1 commit intomainfrom
fix/cargo-multibyte-panic

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Feb 16, 2026

Summary

  • Fix panic when parsing Cargo.toml files containing multi-byte UTF-8 characters (e.g. emoji)
  • saturating_sub on byte offset could land inside a multi-byte char, causing slice panic
  • Adjust search_start to nearest char boundary before slicing

Reproduced with AppFlowy's frontend/rust-lib/Cargo.toml which contains in comments.

Test plan

  • cargo nextest run -p deps-cargo — 91 passed
  • cargo clippy — clean

Adjust search_start to char boundary when slicing content for
dependency name lookup, preventing panic on Cargo.toml files
containing multi-byte UTF-8 characters.
@github-actions github-actions Bot added rust Rust code changes parser Parser changes needs-review Needs review size: XS <10 lines changed labels Feb 16, 2026
@bug-ops bug-ops merged commit 9dada87 into main Feb 16, 2026
20 checks passed
@bug-ops bug-ops deleted the fix/cargo-multibyte-panic branch February 16, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Needs review parser Parser changes rust Rust code changes size: XS <10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant