-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
$ RUST_BACKTRACE=1 nixsa "$(printf '\777')"
thread 'main' panicked at std/src/env.rs:867:51:
called `Result::unwrap()` on an `Err` value: "\xFF"
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: <std::env::Args as core::iter::traits::iterator::Iterator>::next
4: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
5: nixsa::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Here's an example of why this is an issue: paths don't have to be valid UTF-8. Since we're wrapping arbitrary programs, we shouldn't restrict them unnecessarily.
The solution is to use OsString and env::args_os instead of String and env::args, respectively. I'll prepare a PR :D
Edit: turns out it's harder than I expected... 😅
Metadata
Metadata
Assignees
Labels
No labels