-
-
Notifications
You must be signed in to change notification settings - Fork 655
Closed
Description
Summary
uint8 -> int64 has no overflow
Steps to reproduce the behavior
package main
import (
"fmt"
)
func main() {
str := "A\xFF"
i := int64(str[0])
fmt.Printf("%d\n", i)
}
gosec version
Go version (output of 'go version')
go version go1.22.6 darwin/arm64
Operating system / Environment
n/a
Expected behavior
no complaint
Actual behavior
complains
G115: integer overflow conversion uint8 -> int64:
main.go:9:12: G115: integer overflow conversion uint8 -> int64 (gosec)
i := int64(str[0])
^
mmkhmk, NAKKA-K, r--w, firminochangani, blizzy78 and 10 more
Metadata
Metadata
Assignees
Labels
No labels