Forbid exponents larger than 18.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
This commit is contained in:
Jean Pierre Dudey 2018-08-22 14:00:30 -04:00
parent 6902bf826c
commit 9cdc75a930
1 changed files with 12 additions and 2 deletions

View File

@ -156,7 +156,12 @@ impl Decimal {
}
}
}
if past_dec { exponent += 1; }
if past_dec {
exponent += 1;
if exponent > 18 {
return Err(ParseDecimalError::TooBig);
}
}
}
b'.' => { past_dec = true; }
_ => { /* whitespace or something, just ignore it */ }
@ -314,7 +319,12 @@ impl UDecimal {
}
}
}
if past_dec { exponent += 1; }
if past_dec {
exponent += 1;
if exponent > 18 {
return Err(ParseDecimalError::TooBig);
}
}
}
b'.' => { past_dec = true; }
_ => { /* whitespace or something, just ignore it */ }