Files
codeql/go/ql/test/query-tests/Security/CWE-681/Test32BitArchitectureBuildConstraintInFileName_386.go
Owen Mansel-Chan d52b23db8e Improve tests for Incorrect Integer Conversion
We changed the test query when the query was changed so that the
comments in the test file would stay the same.
I've reverted the test query and updated the comments in the test file.
This avoids problems in the branch switching to use-use flow.
2023-11-30 11:58:10 +00:00

35 lines
542 B
Go

// Note that the filename acts as an implicit build constraint
package main
import (
"strconv"
)
func testIntSource386() {
{
parsed, err := strconv.ParseInt("3456", 10, 0)
if err != nil {
panic(err)
}
_ = int32(parsed)
_ = uint32(parsed)
}
{
parsed, err := strconv.ParseUint("3456", 10, 0)
if err != nil {
panic(err)
}
_ = int32(parsed) // $ hasValueFlow="parsed"
_ = uint32(parsed)
}
{
parsed, err := strconv.Atoi("3456")
if err != nil {
panic(err)
}
_ = int32(parsed)
_ = uint32(parsed)
}
}