Skip to content

Commit 1c080e0

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

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sql/system_enumtype.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package sql
1616

1717
import (
1818
"math"
19+
_ "math"
1920
"reflect"
2021
"strings"
2122

@@ -93,7 +94,10 @@ func (t systemEnumType) Convert(v interface{}) (interface{}, error) {
9394
case uint32:
9495
return t.Convert(int(value))
9596
case int64:
96-
return t.Convert(int(value))
97+
if value >= math.MinInt && value <= math.MaxInt {
98+
return t.Convert(int(value))
99+
}
100+
return nil, ErrInvalidSystemVariableValue.New(t.varName, value)
97101
case uint64:
98102
if value <= math.MaxInt {
99103
return t.Convert(int(value))

0 commit comments

Comments
 (0)