diff options
| author | Ryan Snyder <ryan@vector35.com> | 2018-09-18 12:25:44 -0400 |
|---|---|---|
| committer | Ryan Snyder <ryan@vector35.com> | 2018-09-18 13:07:21 -0400 |
| commit | 536908c5d4ba2f919765b41a050269669c800a75 (patch) | |
| tree | 5daf28ea98d84057e81f6bd61506730955ac480e /python/basicblock.py | |
| parent | 1fc4e3eaffa0aa5dfb5f2c70bc350e95c9232bde (diff) | |
python: make BasicBlocks iterate over disassembly lines, not instrs
In certain situations Architecture implementations can return different
lengths in get_instruction_info and get_instruction_text (e.g.
pseudo-instructions). Since BasicBlock's __iter__ method returns
disassembly lines, we should advance by the length returned by that
callback instead of get_instruction_info, which could be different.
Diffstat (limited to 'python/basicblock.py')
| -rw-r--r-- | python/basicblock.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/python/basicblock.py b/python/basicblock.py index c98794cb..8f16f71a 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -304,13 +304,11 @@ class BasicBlock(object): idx = start while idx < end: data = self.view.read(idx, min(self.arch.max_instr_length, end - idx)) - inst_info = self.arch.get_instruction_info(data, idx) inst_text = self.arch.get_instruction_text(data, idx) - - if inst_info is None: + if inst_text[1] == 0: break yield inst_text - idx += inst_info.length + idx += inst_text[1] def mark_recent_use(self): core.BNMarkBasicBlockAsRecentlyUsed(self.handle) |
