Skip to content

Commit 35fd5cb

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

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/system_settype.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func (t systemSetType) Convert(v interface{}) (interface{}, error) {
9292
// Therefore, if the float doesn't have a fractional portion, we treat it as an int.
9393
if value >= float64(math.MinInt64) && value <= float64(math.MaxInt64) {
9494
if math.Trunc(value) == value { // Ensure no fractional part exists
95+
if value < 0 || value > math.MaxInt64 { // Additional bounds check
96+
return nil, ErrInvalidSystemVariableValue.New(t.varName, v) // Reject out-of-range values
97+
}
9598
intValue := int64(value)
9699
return t.SetType.Convert(intValue)
97100
}

0 commit comments

Comments
 (0)