Skip to content

Commit 3e91e40

Browse files
committed
seq: Trim whitespaces, then try to remove +
Otherwise, `seq` crashes with ` 0xee.` as input.
1 parent 97fb15b commit 3e91e40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/uu/seq/src/numberparse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ pub enum ParseNumberError {
2727
// need to be too careful.
2828
fn compute_num_digits(input: &str, ebd: ExtendedBigDecimal) -> PreciseNumber {
2929
let input = input.to_lowercase();
30+
let input = input.trim_start();
3031

3132
// Leading + is ignored for this.
32-
let input = input.trim_start().strip_prefix('+').unwrap_or(&input);
33+
let input = input.strip_prefix('+').unwrap_or(&input);
3334

3435
// Integral digits for any hex number is ill-defined (0 is fine as an output)
3536
// Fractional digits for an floating hex number is ill-defined, return None

0 commit comments

Comments
 (0)