about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2018-11-17 17:23:53 +0100
committerGitHub <noreply@github.com>2018-11-17 17:23:53 +0100
commit3fc672fad2d703e9e36e0e964547e67c674cc4c7 (patch)
tree084fa292fb72a22cbfa7942fc972e4531966fff1
parente7aa5e60bb84cebe4778a736fc4ca792fa6050f1 (diff)
parent2516fcdc644206ffee4fe9f28a016e2d91f0fdc2 (diff)
downloadmiasm-3fc672fad2d703e9e36e0e964547e67c674cc4c7.tar.gz
miasm-3fc672fad2d703e9e36e0e964547e67c674cc4c7.zip
Merge pull request #888 from serpilliere/fix_disasm_null_blk
Core/Asmblock: fix null starting block condition
-rw-r--r--miasm2/core/asmblock.py14
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