mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 11:35:51 +00:00
Prevent panic: unexpected constant value: <nil> (#1232)
This commit is contained in:
parent
6741874d9b
commit
1d23143bee
1 changed files with 5 additions and 1 deletions
|
@ -360,7 +360,11 @@ func updateResultFromBinOp(result *rangeResult, binOp *ssa.BinOp, instr *ssa.Con
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// TODO: constVal.Value nil check avoids #1229 panic but seems to be hiding a bug in the code above or in x/tools/go/ssa.
|
||||||
|
if constVal.Value == nil {
|
||||||
|
// log.Fatalf("[gosec] constVal.Value is nil flipped=%t, constVal=%#v, binOp=%#v", operandsFlipped, constVal, binOp)
|
||||||
|
return
|
||||||
|
}
|
||||||
switch binOp.Op {
|
switch binOp.Op {
|
||||||
case token.LEQ, token.LSS:
|
case token.LEQ, token.LSS:
|
||||||
updateMinMaxForLessOrEqual(result, constVal, binOp.Op, operandsFlipped, successPathConvert)
|
updateMinMaxForLessOrEqual(result, constVal, binOp.Op, operandsFlipped, successPathConvert)
|
||||||
|
|
Loading…
Reference in a new issue