Merge pull request #153 from nyw0102/kalker-skillful-perlman

Fix: Reachable assertion (radix is to high)
This commit is contained in:
PaddiM8 2024-05-21 10:51:09 +02:00 committed by GitHub
commit bcc0f947f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -793,6 +793,10 @@ fn string_to_num(value: &str) -> Result<KalkFloat, KalkError> {
} }
let base = get_base(value)?; let base = get_base(value)?;
if base > 36 {
return Err(KalkError::InvalidNumberLiteral(value.into()));
}
if let Some(result) = crate::radix::parse_float_radix(&value.replace(' ', ""), base) { if let Some(result) = crate::radix::parse_float_radix(&value.replace(' ', ""), base) {
Ok(crate::float!(result)) Ok(crate::float!(result))
} else { } else {