Skip to content

Commit 8fd5726

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

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sql/system_booltype.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ func (t systemBoolType) Convert(v interface{}) (interface{}, error) {
101101
case float64:
102102
// Float values aren't truly accepted, but the engine will give them when it should give ints.
103103
// Therefore, if the float doesn't have a fractional portion, we treat it as an int.
104-
if value == float64(int64(value)) {
105-
if value >= float64(math.MinInt64) && value <= float64(math.MaxInt64) {
104+
if value >= float64(math.MinInt64) && value <= float64(math.MaxInt64) {
105+
if value == float64(int64(value)) {
106106
intVal := int64(value)
107107
if intVal >= math.MinInt8 && intVal <= math.MaxInt8 {
108108
return int8(intVal), nil
109109
}
110110
}
111111
return nil, ErrInvalidSystemVariableValue.New(t.varName, v)
112112
}
113+
return nil, ErrInvalidSystemVariableValue.New(t.varName, v)
113114
case decimal.Decimal:
114115
f, _ := value.Float64()
115116
return t.Convert(f)

0 commit comments

Comments
 (0)