From 3cebf8ba75f3f4786e8018768828dd6399a3d35f Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Fri, 13 Sep 2024 13:47:15 +0100 Subject: [PATCH] PS: Also include parameter reads and writes as SSA reads and writes. --- .../code/powershell/dataflow/internal/SsaImpl.qll | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/powershell/ql/lib/semmle/code/powershell/dataflow/internal/SsaImpl.qll b/powershell/ql/lib/semmle/code/powershell/dataflow/internal/SsaImpl.qll index 1d140e09a71..d4cbc390381 100644 --- a/powershell/ql/lib/semmle/code/powershell/dataflow/internal/SsaImpl.qll +++ b/powershell/ql/lib/semmle/code/powershell/dataflow/internal/SsaImpl.qll @@ -19,7 +19,7 @@ module SsaInput implements SsaImplCommon::InputSig { class ExitBasicBlock extends BasicBlock, BasicBlocks::ExitBasicBlock { } - class SourceVariable = LocalVariable; + class SourceVariable = LocalScopeVariable; /** * Holds if the statement at index `i` of basic block `bb` contains a write to variable `v`. @@ -34,7 +34,7 @@ module SsaInput implements SsaImplCommon::InputSig { certain = true } - predicate variableRead(BasicBlock bb, int i, LocalVariable v, boolean certain) { + predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) { variableReadActual(bb, i, v) and certain = true } @@ -59,7 +59,7 @@ predicate uninitializedWrite(Cfg::EntryBasicBlock bb, int i, LocalVariable v) { } /** Holds if `v` is read at index `i` in basic block `bb`. */ -private predicate variableReadActual(Cfg::BasicBlock bb, int i, LocalVariable v) { +private predicate variableReadActual(Cfg::BasicBlock bb, int i, LocalScopeVariable v) { exists(VarReadAccess read | read.getVariable() = v and read = bb.getNode(i).getAstNode() @@ -152,7 +152,7 @@ private module Cached { */ cached predicate variableWriteActual( - Cfg::BasicBlock bb, int i, LocalVariable v, VariableWriteAccessCfgNode write + Cfg::BasicBlock bb, int i, LocalScopeVariable v, VarWriteAccessCfgNode write ) { exists(Cfg::CfgNode n | write.getVariable() = v and @@ -164,7 +164,7 @@ private module Cached { cached VarReadAccessCfgNode getARead(Definition def) { - exists(LocalVariable v, Cfg::BasicBlock bb, int i | + exists(SsaInput::SourceVariable v, Cfg::BasicBlock bb, int i | Impl::ssaDefReachesRead(v, def, bb, i) and variableReadActual(bb, i, v) and result = bb.getNode(i)