mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
select: Fix integer conversion overflow (#10437)
Do not convert float value to integer if it will over/underflow. The comparison cannot be `<=` since rounding may overflow it. Fixes #10436
This commit is contained in:
@@ -309,7 +309,7 @@ func (v Value) CSVString() string {
|
||||
// floatToValue converts a float into int representation if needed.
|
||||
func floatToValue(f float64) *Value {
|
||||
intPart, fracPart := math.Modf(f)
|
||||
if fracPart == 0 {
|
||||
if fracPart == 0 && intPart < math.MaxInt64 && intPart > math.MinInt64 {
|
||||
return FromInt(int64(intPart))
|
||||
}
|
||||
return FromFloat(f)
|
||||
|
||||
Reference in New Issue
Block a user