From ee97acefcd3e8f8091eb715d355f9b220fd97fc0 Mon Sep 17 00:00:00 2001 From: Aditya Sharad Date: Wed, 22 Dec 2021 16:04:51 -0800 Subject: [PATCH] JS: Minor simplication of ranked basic block calculation We have to look up the node index within the block anyway, so include it as an aggregation variable. --- javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll b/javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll index 3f94bcc36eb..18719b3a15b 100644 --- a/javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll +++ b/javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll @@ -462,15 +462,15 @@ module AccessPath { ReachableBasicBlock bb, Root root, string path, int ranking, AccessPathKind type ) { result = - rank[ranking](ControlFlowNode ref | + rank[ranking](ControlFlowNode ref, int i | ref = getAccessTo(root, path, _) and - ref.getBasicBlock() = bb and + ref = bb.getNode(i) and // Prunes the accesses where there does not exists a read and write within the same basicblock. // This could be more precise, but doing it like this avoids massive joins. hasRead(bb) and hasWrite(bb) | - ref order by any(int i | ref = bb.getNode(i)) + ref order by i ) and result = getAccessTo(root, path, type) }