Skip to content

Commit e2e6825

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 13e95a1 commit e2e6825

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sql/timetype.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ func (t timespanType) ConvertToTimespan(v interface{}) (Timespan, error) {
164164
}
165165
}
166166
case uint64:
167+
if value > math.MaxInt64 {
168+
return Timespan{}, fmt.Errorf("value %d exceeds int64 maximum limit", value)
169+
}
170+
// Explicit bounds check added to prevent overflow during conversion to int64.
171+
if value > math.MaxInt64 {
172+
return Timespan{}, fmt.Errorf("value %d exceeds int64 maximum limit", value)
173+
}
167174
return t.ConvertToTimespan(int64(value))
168175
case float32:
169176
return t.ConvertToTimespan(float64(value))

0 commit comments

Comments
 (0)