CodeQL library for Go
codeql/go-all 4.2.7 (changelog, source)
Search

Predicate ConversionWithoutBoundsCheckConfig::isSink2

Holds if sink is a typecast to an integer type with size bitSize (where 0 represents architecture-dependent) and the expression being typecast is not also in a right-shift expression. We allow this case because it is a common pattern to serialise byte(v), byte(v >> 8), and so on.

Import path

import semmle.go.security.IncorrectIntegerConversionLib
predicate isSink2(TypeCastNode sink, FlowState state)