Skip to content

Commit

Permalink
fix(cellUnderflow): Don't track processed calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jubnzv committed Nov 19, 2024
1 parent 1ecfd29 commit 38dbe95
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/detectors/builtin/cellUnderflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ class CellUnderflowLattice implements JoinSemilattice<CellUnderflowState> {
}

class CellUnderflowTransfer implements Transfer<CellUnderflowState> {
// Track processed calls across all iterations
private processedCalls = new Set<AstNode["id"]>();

public transfer(
inState: CellUnderflowState,
_node: BasicBlock,
Expand Down Expand Up @@ -507,12 +504,6 @@ class CellUnderflowTransfer implements Transfer<CellUnderflowState> {
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 =
Expand Down Expand Up @@ -743,14 +734,15 @@ class CellUnderflowTransfer implements Transfer<CellUnderflowState> {
out: CellUnderflowState,
stmt: AstStatement,
): void {
const processedCalls = new Set<AstNode["id"]>();
forEachExpression(stmt, (expr) => {
const callsChain = getMethodCallsChain(expr);
if (callsChain === undefined) return;

// 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;
}
});
Expand Down

0 comments on commit 38dbe95

Please sign in to comment.