Skip to content

Commit fa7e9be

Browse files
Potential fix for code scanning alert no. 231: Incorrect conversion between integer types
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 62d5ce0 commit fa7e9be

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/timetype.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ func (t timespanType) ConvertToTimespan(v interface{}) (Timespan, error) {
175175
case float32:
176176
return t.ConvertToTimespan(float64(value))
177177
case float64:
178+
if value < float64(math.MinInt64) || value > float64(math.MaxInt64) {
179+
return Timespan(0), fmt.Errorf("float64 value %f exceeds int64 bounds", value)
180+
}
178181
intValue := int64(value)
179182
microseconds := int64Abs(int64(math.Round((value - float64(intValue)) * float64(microsecondsPerSecond))))
180183
absValue := int64Abs(intValue)

0 commit comments

Comments
 (0)