Skip to content

Replace String::from_utf8().unwrap() with from_utf8_lossy()#25

Merged
AdrianEddy merged 1 commit intorisoflora:mainfrom
fasuizu-br:fix/issue-19-utf8-panic
Jan 29, 2026
Merged

Replace String::from_utf8().unwrap() with from_utf8_lossy()#25
AdrianEddy merged 1 commit intorisoflora:mainfrom
fasuizu-br:fix/issue-19-utf8-panic

Conversation

@fasuizu-br
Copy link

Summary

invoke_script() (macOS) and run_command() (Linux) use String::from_utf8(output.stderr).unwrap() which panics if stderr contains non-UTF-8 bytes. Replaced with String::from_utf8_lossy() which safely handles invalid sequences.

Closes #19

Test plan

  • cargo check --target aarch64-apple-darwin passes

Prevent panics on non-UTF-8 stderr output in invoke_script() (macOS)
and run_command() (Linux) by using String::from_utf8_lossy() which
replaces invalid sequences with the Unicode replacement character.

Closes risoflora#19
@AdrianEddy AdrianEddy merged commit 3506bb2 into risoflora:main Jan 29, 2026
4 checks passed
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.

Bug: String::from_utf8().unwrap() can panic on invalid stderr

2 participants