From 99c211955b2b00a9c95914b835f8ab6a0e3bcb52 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 23 May 2023 14:31:25 +0100 Subject: [PATCH] Hotfix: Go: exclude method receivers from dead-store-of-field query --- go/ql/src/RedundantCode/DeadStoreOfField.ql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/go/ql/src/RedundantCode/DeadStoreOfField.ql b/go/ql/src/RedundantCode/DeadStoreOfField.ql index 9dd2c4de65c..edc1d62cb00 100644 --- a/go/ql/src/RedundantCode/DeadStoreOfField.ql +++ b/go/ql/src/RedundantCode/DeadStoreOfField.ql @@ -38,6 +38,9 @@ predicate escapes(DataFlow::Node nd) { // if `nd` is passed to a function, then it escapes nd = any(DataFlow::CallNode c).getASyntacticArgument() or + // if `nd` is the receiver of a function, then it escapes + nd = any(DataFlow::MethodCallNode c).getReceiver() + or // if `nd` has its address taken, then it escapes exists(AddressExpr ae | nd.asExpr() = ae.getOperand()) or