Skip to content

Commit fad10cc

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

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sql/expression/function/greatest_least.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"strconv"
2020
"strings"
2121
"time"
22+
"math"
2223

2324
"gopkg.in/src-d/go-errors.v1"
2425

@@ -126,6 +127,9 @@ func compEval(
126127

127128
switch returnType {
128129
case sql.Int64:
130+
if selectedNum < float64(math.MinInt64) || selectedNum > float64(math.MaxInt64) {
131+
return nil, ErrUintOverflow.New()
132+
}
129133
return int64(selectedNum), nil
130134
case sql.LongText:
131135
return selectedString, nil

0 commit comments

Comments
 (0)