You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing a sting representation of a float value with a mantissa of zero and a huge exponent will result in constant.MakeFromLiteral hanging. The reason for this is that a 0 mantissa is special-cased during big.Float parsing, but not during big.Rat parsing. This means that a value like 0e9999999999 will parse successfully in big.Float.SetString, but will hang in big.Rat.SetString. This discrepancy becomes an issue in makeFloatFromLiteral, where the big.Float will report an exponent of 0, so big.Rat.SetString will be used and will subsequently hang.
The solution to this problem is to special-case a zero mantissa during big.Rat parsing as well, so that neither big.Rat nor big.Float will hang when parsing a value with a 0 mantissa but a large exponent. The fix is underway in https://go-review.googlesource.com/#/c/24430/.
See https://play.golang.org/p/lKi0ESs-FE for an example.
Passing a sting representation of a float value with a mantissa of zero and a huge exponent will result in
constant.MakeFromLiteral
hanging. The reason for this is that a 0 mantissa is special-cased duringbig.Float
parsing, but not duringbig.Rat
parsing. This means that a value like0e9999999999
will parse successfully inbig.Float.SetString
, but will hang inbig.Rat.SetString
. This discrepancy becomes an issue inmakeFloatFromLiteral
, where thebig.Float
will report an exponent of0
, sobig.Rat.SetString
will be used and will subsequently hang.The solution to this problem is to special-case a zero mantissa during
big.Rat
parsing as well, so that neitherbig.Rat
norbig.Float
will hang when parsing a value with a0
mantissa but a large exponent. The fix is underway in https://go-review.googlesource.com/#/c/24430/.This was discovered using go-fuzz on CockroachDB:
https://github.com/cockroachdb/go-fuzz/blob/master/examples/parser/main.go. @dvyukov
The text was updated successfully, but these errors were encountered: