mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-07 09:14:26 +01:00
Merge 'Fix out of bounds access on parse_numeric_str' from Levy A.
Fixes #1361. Closes #1362
This commit is contained in:
@@ -912,11 +912,10 @@ fn parse_numeric_str(text: &str) -> Result<(OwnedValueType, &str), ()> {
|
||||
let text = text.trim();
|
||||
let bytes = text.as_bytes();
|
||||
|
||||
if bytes.is_empty()
|
||||
|| bytes[0] == b'e'
|
||||
|| bytes[0] == b'E'
|
||||
|| (bytes[0] == b'.' && (bytes[1] == b'e' || bytes[1] == b'E'))
|
||||
{
|
||||
if matches!(
|
||||
bytes,
|
||||
[] | [b'e', ..] | [b'E', ..] | [b'.', b'e' | b'E', ..]
|
||||
) {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user