Merge pull request #329 from crytic/dev-fix-loop-break

Fix parsing of infinite loop with break
pull/335/head
Feist Josselin 5 years ago committed by GitHub
commit bb939ccf99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      slither/solc_parsing/declarations/function.py

@ -824,7 +824,12 @@ class FunctionSolc(Function):
end_node = self._find_end_loop(node, [], 0) end_node = self._find_end_loop(node, [], 0)
if not end_node: if not end_node:
raise ParsingError('Break in no-loop context {}'.format(node)) # If there is not end condition on the loop
# The exploration will reach a STARTLOOP before reaching the endloop
# We start with -1 as counter to catch this corner case
end_node = self._find_end_loop(node, [], -1)
if not end_node:
raise ParsingError('Break in no-loop context {}'.format(node.function))
for son in node.sons: for son in node.sons:
son.remove_father(node) son.remove_father(node)

Loading…
Cancel
Save