From 772a075ff59699fa0563d86c50595c832e645352 Mon Sep 17 00:00:00 2001 From: Hecate2 <2474101468@qq.com> Date: Thu, 19 Sep 2024 16:56:01 +0800 Subject: [PATCH] fix false positive when a basic block write before call --- .../SecurityAnalyzer/ReEntrancyAnalyzer.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Neo.Compiler.CSharp/SecurityAnalyzer/ReEntrancyAnalyzer.cs b/src/Neo.Compiler.CSharp/SecurityAnalyzer/ReEntrancyAnalyzer.cs index c91d72cee..2b800bd34 100644 --- a/src/Neo.Compiler.CSharp/SecurityAnalyzer/ReEntrancyAnalyzer.cs +++ b/src/Neo.Compiler.CSharp/SecurityAnalyzer/ReEntrancyAnalyzer.cs @@ -118,11 +118,10 @@ public static ReEntrancyVulnerabilityPair AnalyzeSingleContractReEntrancy foreach (BasicBlock block in basicBlocks.Where(b => writeStorageInstructions[b].Count > 0)) { HashSet visited = new(); - Queue q = new([block]); - BasicBlock current = block; + Queue q = new(reverseRef[block]); while (q.Count > 0) { - current = q.Dequeue(); + BasicBlock current = q.Dequeue(); visited.Add(current); if (callOtherContractInstructions[current].Count > 0) vulnerabilityPairs[current].Add(block);