mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Fix go/impossible-interface-nil-check for separate post-update nodes
When tracing back from nil checks on interfaces, ignore post-update nodes. There will always be a corresponding pre-update node that contains the information we want.
This commit is contained in:
@@ -35,7 +35,9 @@ predicate flowsToInterfaceNilCheck(DataFlow::Node nd) {
|
||||
*/
|
||||
predicate nonNilWrapper(DataFlow::Node nd) {
|
||||
flowsToInterfaceNilCheck(nd) and
|
||||
forex(DataFlow::Node pred | pred = nd.getAPredecessor() |
|
||||
forex(DataFlow::Node pred |
|
||||
pred = nd.getAPredecessor() and not pred instanceof DataFlow::PostUpdateNode
|
||||
|
|
||||
exists(Type predtp | predtp = pred.getType().getUnderlyingType() |
|
||||
not predtp instanceof InterfaceType and
|
||||
not predtp instanceof NilLiteralType and
|
||||
|
||||
Reference in New Issue
Block a user