mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-23 13:11:15 -03:00
Merge pull request #11627
This commit is contained in:
@@ -110,7 +110,7 @@ fn parse_numeric_sequence<I>(chars: I) -> Option<(usize, u8)>
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut val = 0;
|
||||
let mut val: u8 = 0;
|
||||
let mut consumed = start;
|
||||
for digit in chars
|
||||
.skip(start)
|
||||
@@ -120,7 +120,7 @@ fn parse_numeric_sequence<I>(chars: I) -> Option<(usize, u8)>
|
||||
// base is either 8 or 16, so digit can never be >255
|
||||
let digit = u8::try_from(digit).unwrap();
|
||||
|
||||
val = val * base + digit;
|
||||
val = val.wrapping_mul(base).wrapping_add(digit);
|
||||
|
||||
consumed += 1;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,11 @@ echo -e 'abc\121def'
|
||||
echo -e 'abc\1212def'
|
||||
#CHECK: abcQdef
|
||||
#CHECK: abcQ2def
|
||||
# Test octal overflow: \5555 = 555 octal = 365 decimal, wraps to 109 decimal (155 octal)
|
||||
# Followed by literal '5' character (065 octal)
|
||||
echo -ne '\5555' | display_bytes
|
||||
#CHECK: 0000000 155 065
|
||||
#CHECK: 0000002
|
||||
echo -e 'abc\cdef' # won't output a newline!
|
||||
#CHECK: abc
|
||||
echo ''
|
||||
|
||||
Reference in New Issue
Block a user