mirror of
https://github.com/securego/gosec.git
synced 2025-07-03 00:27:05 +02:00
Add a rule which detects when there is potential integer overflow (#422)
* Add G109(Potential Integer OverFlow Detection) Signed-off-by: Hiroki Suezawa <suezawa@gmail.com> * add CWE to G109(Potential Integer Overflow) Signed-off-by: Hiroki Suezawa <suezawa@gmail.com> * Modify G109 to use gosec.Context Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
This commit is contained in:
committed by
Cosmin Cojocar
parent
f43a957359
commit
9cb83e10af
@ -109,12 +109,13 @@ func (p *TestPackage) CreateContext(filename string) *gosec.Context {
|
||||
pkgFile = strings.TrimPrefix(pkgFile, strip)
|
||||
if pkgFile == filename {
|
||||
ctx := &gosec.Context{
|
||||
FileSet: pkg.Fset,
|
||||
Root: file,
|
||||
Config: gosec.NewConfig(),
|
||||
Info: pkg.TypesInfo,
|
||||
Pkg: pkg.Types,
|
||||
Imports: gosec.NewImportTracker(),
|
||||
FileSet: pkg.Fset,
|
||||
Root: file,
|
||||
Config: gosec.NewConfig(),
|
||||
Info: pkg.TypesInfo,
|
||||
Pkg: pkg.Types,
|
||||
Imports: gosec.NewImportTracker(),
|
||||
PassedValues: make(map[string]interface{}),
|
||||
}
|
||||
ctx.Imports.TrackPackages(ctx.Pkg.Imports()...)
|
||||
return ctx
|
||||
|
Reference in New Issue
Block a user