Skip to content

fix: sanitize filter targets to prevent fuzzy search panic on binary data#331

Open
Castrozan wants to merge 1 commit intosavedra1:mainfrom
Castrozan:fix/fuzzy-filter-panic
Open

fix: sanitize filter targets to prevent fuzzy search panic on binary data#331
Castrozan wants to merge 1 commit intosavedra1:mainfrom
Castrozan:fix/fuzzy-filter-panic

Conversation

@Castrozan
Copy link

@Castrozan Castrozan commented Feb 9, 2026

Summary

  • Strip non-printable characters from filter targets before passing to the fuzzy search algorithm
  • The sahilm/fuzzy library panics with index out of range when it encounters non-ASCII/binary data in clipboard entries (typically from copied images)
  • This preserves full fuzzy matching — search works normally on the printable text content

Context

Fix for #148. The root cause is in sahilm/fuzzy which doesn't handle all byte sequences safely. Rather than patching the dependency, we sanitize inputs with unicode.IsPrint before they reach the fuzzy matcher.

Test plan

  • Open clipse TUI with images in clipboard history
  • Press / to enter filter mode
  • Type single characters that previously caused a crash (varies per history content — common triggers: a, f, g, i, t)
  • Verify fuzzy search returns matching results normally
  • Verify image entries don't cause crashes during filtering

…data

The sahilm/fuzzy library panics with 'index out of range' when the
fuzzy matching algorithm encounters clipboard entries containing
non-printable or binary data from copied images. This causes the TUI
to crash when typing certain characters as the first filter character.

Strip non-printable characters from filter targets before passing to
the fuzzy search. This preserves full fuzzy matching behavior on the
printable text content.

Fixes savedra1#148
@Castrozan Castrozan force-pushed the fix/fuzzy-filter-panic branch from a2edf47 to 2ea7ccc Compare February 9, 2026 22:48
@Castrozan Castrozan changed the title fix: wrap list filter with panic recovery for binary clipboard data fix: sanitize filter targets to prevent fuzzy search panic on binary data Feb 9, 2026
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