mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
fish_indent: Fix crash with NUL in the source
Really we should *reject* this
This commit is contained in:
@@ -521,11 +521,14 @@ fn clean_text(&self, input: &wstr) -> WString {
|
||||
// Unescape the string - this leaves special markers around if there are any
|
||||
// expansions or anything. We specifically tell it to not compute backslash-escapes
|
||||
// like \U or \x, because we want to leave them intact.
|
||||
let mut unescaped = unescape_string(
|
||||
let Some(mut unescaped) = unescape_string(
|
||||
input,
|
||||
UnescapeStringStyle::Script(UnescapeFlags::SPECIAL | UnescapeFlags::NO_BACKSLASHES),
|
||||
)
|
||||
.unwrap();
|
||||
// TODO: If we cannot unescape that means there's something fishy,
|
||||
// like a NUL in the source.
|
||||
) else {
|
||||
return input.into();
|
||||
};
|
||||
|
||||
// Remove INTERNAL_SEPARATOR because that's a quote.
|
||||
let quote = |ch| ch == INTERNAL_SEPARATOR;
|
||||
|
||||
Reference in New Issue
Block a user