mirror of
https://github.com/securego/gosec.git
synced 2025-07-03 00:27:05 +02:00
Resolve underlying type to detect overflows in type aliases
This commit is contained in:
committed by
Cosmin Cojocar
parent
4487a0c5a2
commit
08b94f9392
@ -47,8 +47,8 @@ func runConversionOverflow(pass *analysis.Pass) (interface{}, error) {
|
||||
for _, instr := range block.Instrs {
|
||||
switch instr := instr.(type) {
|
||||
case *ssa.Convert:
|
||||
src := instr.X.Type().String()
|
||||
dst := instr.Type().String()
|
||||
src := instr.X.Type().Underlying().String()
|
||||
dst := instr.Type().Underlying().String()
|
||||
if isIntOverflow(src, dst) {
|
||||
issue := newIssue(pass.Analyzer.Name,
|
||||
fmt.Sprintf("integer overflow conversion %s -> %s", src, dst),
|
||||
|
Reference in New Issue
Block a user