Skip to content

Commit 13e95a1

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

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sql/yeartype.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ func (t yearType) Convert(v interface{}) (interface{}, error) {
113113
case float32:
114114
return t.Convert(int64(value))
115115
case float64:
116-
if value < float64(math.MinInt64) || value > float64(math.MaxInt64) {
117-
return nil, ErrConvertingToYear.New("float64 value out of bounds for int64")
116+
if value < float64(math.MinInt16) || value > float64(math.MaxInt16) {
117+
return nil, ErrConvertingToYear.New("float64 value out of bounds for int16")
118118
}
119-
return t.Convert(int64(value))
119+
return t.Convert(int16(value))
120120
case decimal.Decimal:
121121
return t.Convert(value.IntPart())
122122
case decimal.NullDecimal:

0 commit comments

Comments
 (0)