Skip to content

Commit af7dc59

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sql/system_settype.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ 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
95+
// Additional bounds check for out-of-range values
96+
if value < float64(math.MinInt64) || value > float64(math.MaxInt64) {
9697
return nil, ErrInvalidSystemVariableValue.New(t.varName, v) // Reject out-of-range values
9798
}
9899
intValue := int64(value)

0 commit comments

Comments
 (0)