Skip to content

Commit b6e33dd

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sql/expression/function/ceil_round_floor.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ func (r *Round) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
261261
case int8:
262262
dVal = float64(dNum)
263263
case uint64:
264-
dVal = float64(dNum)
264+
if dNum > math.MaxInt64 {
265+
return nil, fmt.Errorf("value %d exceeds the maximum value for int64", dNum)
266+
}
267+
dVal = float64(int64(dNum))
265268
case uint32:
266269
dVal = float64(dNum)
267270
case uint16:

0 commit comments

Comments
 (0)