Skip to content

Commit 045728a

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sql/system_booltype.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ func (t systemBoolType) Convert(v interface{}) (interface{}, error) {
9898
// Float values aren't truly accepted, but the engine will give them when it should give ints.
9999
// Therefore, if the float doesn't have a fractional portion, we treat it as an int.
100100
if value == float64(int64(value)) {
101-
return t.Convert(int64(value))
101+
if value >= float64(math.MinInt64) && value <= float64(math.MaxInt64) {
102+
return t.Convert(int64(value))
103+
}
104+
return nil, ErrInvalidSystemVariableValue.New(t.varName, v)
102105
}
103106
case decimal.Decimal:
104107
f, _ := value.Float64()

0 commit comments

Comments
 (0)