-
-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Description
Hello,
I was going through the source code of msgpack and noticed a potential issue in the float64 method in the decode_number.go file.
Here is the code snippet:
func (d *Decoder) float64(c codes.Code) (float64, error) {
switch c {
case codes.Float:
n, err := d.float32(c)
if err != nil {
return 0, err
}
return float64(n), nil
case codes.Double:
n, err := d.uint64()
if err != nil {
return 0, err
}
return math.Float64frombits(n), nil
}
n, err := d.int(c)
if err != nil {
return 0, fmt.Errorf("msgpack: invalid code=%x decoding float32", c)
}
return float64(n), nil
}
In the error message of the last fmt.Errorf, it says "decoding float32", but it should be "decoding float64" as the method is for decoding a float64 value.
The corrected error message should be:
return 0, fmt.Errorf("msgpack: invalid code=%x decoding float64", c)Metadata
Metadata
Assignees
Labels
No labels