Skip to content

Commit

Permalink
fix range conditions
Browse files Browse the repository at this point in the history
Signed-off-by: czechbol <adamludes@gmail.com>
  • Loading branch information
czechbol committed Sep 4, 2024
1 parent aab03af commit b131cc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions analyzers/conversion_overflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ func updateResultFromBinOp(result *rangeResult, binOp *ssa.BinOp, instr *ssa.Con
min := result.minValue
max := result.maxValue

if min > 0 {
if min >= 0 {
result.maxValue = uint(min)
}
if max < math.MaxInt {
if max <= math.MaxInt {
result.minValue = int(max)

Check failure on line 394 in analyzers/conversion_overflow.go

View workflow job for this annotation

GitHub Actions / test (1.22.6, latest)

G115: integer overflow conversion uint -> int (gosec)
}
}
Expand Down

0 comments on commit b131cc1

Please sign in to comment.