Skip to content

Commit

Permalink
Sanity check for empty AsmBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
nofiv committed Jun 16, 2020
1 parent 975a527 commit 0b87bec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions miasm/core/asmblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ def sanity_check(self):
for loc_key in self._nodes:
if loc_key not in self._loc_key_to_block:
raise RuntimeError("Not supported yet: every node must have a corresponding AsmBlock")

block = self.loc_key_to_block(loc_key)
if not block.lines and not isinstance(block, AsmBlockBad):
raise RuntimeError("Blocks cannot be empty")

# No next constraint to self
if (loc_key, loc_key) in next_edges:
raise RuntimeError('Bad constraint: self in next')
Expand Down

0 comments on commit 0b87bec

Please sign in to comment.