From 38dbe95a5b1927c715d2dcf2da9ad0d9d81a4195 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Tue, 19 Nov 2024 09:52:36 +0000 Subject: [PATCH] fix(cellUnderflow): Don't track processed calls --- src/detectors/builtin/cellUnderflow.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/detectors/builtin/cellUnderflow.ts b/src/detectors/builtin/cellUnderflow.ts index 4f9d0356..f4c33b03 100644 --- a/src/detectors/builtin/cellUnderflow.ts +++ b/src/detectors/builtin/cellUnderflow.ts @@ -225,9 +225,6 @@ class CellUnderflowLattice implements JoinSemilattice { } class CellUnderflowTransfer implements Transfer { - // Track processed calls across all iterations - private processedCalls = new Set(); - public transfer( inState: CellUnderflowState, _node: BasicBlock, @@ -507,12 +504,6 @@ class CellUnderflowTransfer implements Transfer { variable: VariableRhs, call: AstMethodCall, ): void { - // Only update storage if we haven't processed this call in any iteration - if (this.processedCalls.has(call.id)) { - return; - } - this.processedCalls.add(call.id); - const storedRefs = this.getStoredRefs(variable, call); if (storedRefs !== undefined) { variable.value.storage.refsNum.stored = @@ -743,6 +734,7 @@ class CellUnderflowTransfer implements Transfer { out: CellUnderflowState, stmt: AstStatement, ): void { + const processedCalls = new Set(); forEachExpression(stmt, (expr) => { const callsChain = getMethodCallsChain(expr); if (callsChain === undefined) return; @@ -750,7 +742,7 @@ class CellUnderflowTransfer implements Transfer { // Check if these calls were previously processed let hasUnvisited = false; callsChain.calls.forEach((c) => { - if (!this.processedCalls.has(c.id)) { + if (!processedCalls.has(c.id)) { hasUnvisited = true; } });