fix(models): correctly parse float as 64-bits (#19870)
Go tip now enforces that strconv.ParseFloat receives a bitSize parameter of 32 or 64. Previously, any value that was not 32, was treated as 64. The previous value of 10 was likely a copy-paste error from integer parsing.pull/19875/head
parent
5a60488729
commit
0e0a784e29
|
@ -1034,7 +1034,7 @@ func scanNumber(buf []byte, i int) (int, error) {
|
||||||
} else {
|
} else {
|
||||||
// Parse the float to check bounds if it's scientific or the number of digits could be larger than the max range
|
// Parse the float to check bounds if it's scientific or the number of digits could be larger than the max range
|
||||||
if scientific || len(buf[start:i]) >= maxFloat64Digits || len(buf[start:i]) >= minFloat64Digits {
|
if scientific || len(buf[start:i]) >= maxFloat64Digits || len(buf[start:i]) >= minFloat64Digits {
|
||||||
if _, err := parseFloatBytes(buf[start:i], 10); err != nil {
|
if _, err := parseFloatBytes(buf[start:i], 64); err != nil {
|
||||||
return i, fmt.Errorf("invalid float")
|
return i, fmt.Errorf("invalid float")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue