diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-11-17 13:56:14 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-11-17 13:56:14 +0100 |
| commit | 2516fcdc644206ffee4fe9f28a016e2d91f0fdc2 (patch) | |
| tree | 4b99f8ac393d239fa64cf2fdf786787245f2ad6e /miasm2/core/asmblock.py | |
| parent | ac4fe4b4d2f3c30a43a640614c4bf8494878d608 (diff) | |
| download | miasm-2516fcdc644206ffee4fe9f28a016e2d91f0fdc2.tar.gz miasm-2516fcdc644206ffee4fe9f28a016e2d91f0fdc2.zip | |
Core/Asmblock: fix null starting block condition
Updt the code to reflect heuristic: "Don't disassemble if the basic block starts with null bytes"
Diffstat (limited to 'miasm2/core/asmblock.py')
| -rw-r--r-- | miasm2/core/asmblock.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py index 8d6456e0..34f11474 100644 --- a/miasm2/core/asmblock.py +++ b/miasm2/core/asmblock.py @@ -1469,16 +1469,12 @@ class disasmEngine(object): break # XXX TODO nul start block option - if self.dont_dis_nulstart_bloc and instr.b.count('\x00') == instr.l: + if (self.dont_dis_nulstart_bloc and + not cur_block.lines and + instr.b.count('\x00') == instr.l): log_asmblock.warning("reach nul instr at %X", int(off_i)) - if not cur_block.lines: - # Block is empty -> bad block - cur_block = AsmBlockBad(loc_key, errno=AsmBlockBad.ERROR_NULL_STARTING_BLOCK) - else: - # Block is not empty, stop the desassembly pass and add a - # constraint to the next block - loc_key_cst = self.loc_db.get_or_create_offset_location(off_i) - cur_block.add_cst(loc_key_cst, AsmConstraint.c_next) + # Block is empty -> bad block + cur_block = AsmBlockBad(loc_key, errno=AsmBlockBad.ERROR_NULL_STARTING_BLOCK) break # special case: flow graph modificator in delayslot |