nushell/crates/nu-system
Devyn Cairns b296d6ee3c
Improve safety of get_unchecked_str in nu_system::macos (#12550)
# Description
The implementation of this function had a few issues before:

- It didn't check that the `cp` pointer is actually ahead of the `start`
pointer, so `len` could potentially underflow and wrap around, which
would be a violation of memory safety
- It used `Vec::from_raw_parts` even though the buffer is borrowed, not
owned. Although `std::mem::forget` is used later to ensure the
destructor doesn't run, there is a risk that the destructor would run if
a panic happened during `String::from_utf8_unchecked`, which would lead
to a `free()` of a pointer we don't own
2024-04-17 17:10:05 +08:00
..
examples Reduce again the number of match calls (#7815) 2023-01-24 12:23:42 +01:00
src Improve safety of get_unchecked_str in nu_system::macos (#12550) 2024-04-17 17:10:05 +08:00
.gitignore Add nu-system and rewrite ps command (#734) 2022-01-14 17:20:53 +11:00
Cargo.toml Bump version to 0.92.3 (#12476) 2024-04-12 08:00:43 -05:00
LICENSE Nu glob (#4818) 2022-03-13 11:30:27 -07:00