diff --git a/src/main/scala/analysis/NonReturningFunctions.scala b/src/main/scala/analysis/NonReturningFunctions.scala index 6cb4a0b4d..1cada46da 100644 --- a/src/main/scala/analysis/NonReturningFunctions.scala +++ b/src/main/scala/analysis/NonReturningFunctions.scala @@ -58,8 +58,8 @@ class NonReturningFunctions { mapJumpsToBlocks.put(directCall.target.name, mapJumpsToBlocks.getOrElse(directCall.target.name, ArrayBuffer()).addOne((directCall, block))) case goTo: GoTo => mapJumpsToBlocks.put(goTo.target.label, mapJumpsToBlocks.getOrElse(goTo.target.label, ArrayBuffer()).addOne((goTo, block))) - if (isEndlessLoop(proc, goTo, index)) { - + if (proc.blocks.length > index && isEndlessLoop(proc, goTo, index)) { + blocksToRemove.enqueue(proc.blocks(index+1).label) } case _ => } diff --git a/src/main/scala/ir/Program.scala b/src/main/scala/ir/Program.scala index ff1cc5271..81a0a779b 100644 --- a/src/main/scala/ir/Program.scala +++ b/src/main/scala/ir/Program.scala @@ -111,7 +111,7 @@ class Procedure( def calls: Set[Procedure] = blocks.flatMap(_.calls).toSet override def toString: String = { - s"Procedure $name at ${address.getOrElse("None")} with ${blocks.size} blocks and ${in.size} in and ${out.size} out parameters") + s"Procedure $name at ${address.getOrElse("None")} with ${blocks.size} blocks and ${in.size} in and ${out.size} out parameters" } var modifies: mutable.Set[Global] = mutable.Set()