Fix incorrect for(;;) parsing if break is present

pull/329/head
Josselin 5 years ago
parent 9922eb499a
commit cf7d0c73ed
  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