Decode: use cleaned byte slice throughout parseFloat (#735)

Fixes #734
This commit is contained in:
Cameron Moore
2022-01-06 13:34:27 -06:00
committed by GitHub
parent e83cf535f5
commit 146f70ea8a
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -309,10 +309,10 @@ func parseFloat(b []byte) (float64, error) {
}
start := 0
if b[0] == '+' || b[0] == '-' {
if cleaned[0] == '+' || cleaned[0] == '-' {
start = 1
}
if b[start] == '0' && isDigit(b[start+1]) {
if cleaned[start] == '0' && isDigit(cleaned[start+1]) {
return 0, newDecodeError(b, "float integer part cannot have leading zeroes")
}