Skip to content

avoid panics on adversarial filesystem input#1206

Open
curious-rabbit wants to merge 1 commit into
lsd-rs:mainfrom
curious-rabbit:panic
Open

avoid panics on adversarial filesystem input#1206
curious-rabbit wants to merge 1 commit into
lsd-rs:mainfrom
curious-rabbit:panic

Conversation

@curious-rabbit
Copy link
Copy Markdown

Three unwrap and expect sites could crash lsd on valid but unusual filesystem content.

SymLink::from used expect on to_str which panics on non-utf8 symlink targets. GitCache::new unwrapped status_entry.path which is None for non-utf8 filenames. owner::truncate used byte-based String::truncate which panics on multibyte usernames.

Three unwrap and expect sites could crash lsd on valid but unusual
filesystem content.

SymLink::from used expect on to_str which panics on non-utf8 symlink
targets. GitCache::new unwrapped status_entry.path which is None for
non-utf8 filenames. owner::truncate used byte-based String::truncate
which panics on multibyte usernames.

All three now handle the cases cleanly
@curious-rabbit curious-rabbit requested a review from zwpaper as a code owner April 18, 2026 21:40
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