Skip to content

Commit

Permalink
fix invalid bitSize in strconv.ParseFloat (#40753)
Browse files Browse the repository at this point in the history
The bitSize argument in strconv.ParseFloat should be either 32 or 64.
Any value other than 32 will default to 64 in the current implementation,
though this behavior is undocumented, making it undefined.

See https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/strconv/atof.go;l=704-708.
  • Loading branch information
mauri870 authored Sep 11, 2024
1 parent a9fb9fa commit 6e93c27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libbeat/processors/ratelimit/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (l *rate) Unpack(str string) error {
valueStr := strings.TrimSpace(parts[0])
unitStr := strings.TrimSpace(parts[1])

v, err := strconv.ParseFloat(valueStr, 8)
v, err := strconv.ParseFloat(valueStr, 64)
if err != nil {
return fmt.Errorf(`rate's value component is not numeric: %v`, valueStr)
}
Expand Down

0 comments on commit 6e93c27

Please sign in to comment.