From 314787956b8007db23efb589883edced50f4f943 Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Fri, 27 Mar 2020 05:33:24 -0700 Subject: [PATCH] Allow write base to be inside an implicit dereference --- ql/src/semmle/go/controlflow/ControlFlowGraph.qll | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ql/src/semmle/go/controlflow/ControlFlowGraph.qll b/ql/src/semmle/go/controlflow/ControlFlowGraph.qll index e56ca535e5f..2a7a82f4e18 100644 --- a/ql/src/semmle/go/controlflow/ControlFlowGraph.qll +++ b/ql/src/semmle/go/controlflow/ControlFlowGraph.qll @@ -129,7 +129,10 @@ module ControlFlow { /** Holds if this node sets the value of field `f` on `base` to `rhs`. */ predicate writesField(DataFlow::Node base, Field f, DataFlow::Node rhs) { exists(IR::FieldTarget trg | trg = self.getLhs() | - trg.getBase() = base.asInstruction() and + ( + trg.getBase() = base.asInstruction() or + trg.getBase() = MkImplicitDeref(base.asExpr()) + ) and trg.getField() = f and self.getRhs() = rhs.asInstruction() )