Repository navigation
fix: two UTF-8 slicing panics (harmony scan windows, title quotes) - #484
Merged
Merged
Conversation
- harmony: `glitch_near` / `fake_result_after` sliced an 80-byte look-back and a 240-byte look-ahead around an unquoted `to=functions.` marker by byte. With Turkish, CJK or emoji text near the marker (model text, thinking, or an `edit` of such a file), the edge fell inside a character and the agent turn panicked. The edges now round outward to a char boundary. - sanitize_title: `s[1..len-1]` panicked on a curly-quoted title (`“…”`, three bytes each) from the title model, and on a lone `"` (a user rename). Quotes are now stripped with strip_prefix/suffix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mrnasil
enabled auto-merge (squash)
November 25, 2026 13:28
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two crashes found in the code audit, both from slicing a
&strby byte offset.1. Harmony leak scan (
core/src/harmony.rs)glitch_nearandfake_result_afterlook 80 bytes back and 240 bytes ahead of an unquotedto=functions.marker. They slice with raw byte offsets, so with Turkish, CJK or emoji text near the marker the edge lands inside a character and the agent turn panics. The text can be the model's visible text, its thinking, or the arguments of aneditto such a file.Fix: round the edges outward with
floor_char_boundary/ceil_char_boundary, which the repo already uses (MSRV 1.91).Test:
windows_around_a_marker_respect_char_boundariesuses 2-, 3- and 4-byte characters at four shifts. It panics atharmony.rs:187on the old code and passes now.2.
sanitize_title(session/src/title.rs)s[1..s.len() - 1]assumed one-byte quotes:“Fix login bug”, 3 bytes per quote) panicked."(for example/rename ") gaves[1..0]and panicked.Fix:
strip_prefix(open)thenstrip_suffix(close), per quote pair.Tests: cases for curly quotes, a lone
", and''.core and session lib tests, clippy, fmt and budgets pass.
🤖 Generated with Claude Code