You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make invalid Unicode escapes a tokenizer error #8545
Make that if (res > 0 && res <= max_val). If no valid unicode escape is read this stays at 0.
That has the side effect of making \x00 an error as well, which is probably correct considering it can't be passed to commands, not even (currently) to builtins. So it causes things like #8468, which we currently answer by saying "don't do that, then", when, as far as I can tell, the only use for these is in string replace -r inside quotes. This could be handled with a flag to indicate NULLs are acceptable.
The error message might need some work (this would error with "invalid token" with no further explanation).
I went for the simple fix - escapes with no valid digits are rejected. Other things, including NULLs (which are unusable in most contexts) can be done later.
Activity
faho commentedon Feb 24, 2022
A very simple fix would be possible:
fish-shell/src/common.cpp
Lines 1229 to 1234 in 6fcb6f7
Make that
if (res > 0 && res <= max_val). If no valid unicode escape is read this stays at 0.That has the side effect of making
\x00an error as well, which is probably correct considering it can't be passed to commands, not even (currently) to builtins. So it causes things like #8468, which we currently answer by saying "don't do that, then", when, as far as I can tell, the only use for these is instring replace -rinside quotes. This could be handled with a flag to indicate NULLs are acceptable.The error message might need some work (this would error with "invalid token" with no further explanation).
faho commentedon Mar 3, 2022
I went for the simple fix - escapes with no valid digits are rejected. Other things, including NULLs (which are unusable in most contexts) can be done later.