about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2017-03-16 18:34:48 +0100
committerGitHub <noreply@github.com>2017-03-16 18:34:48 +0100
commit7515ea1f0c1b764ece072a4ff6d434da23425b21 (patch)
treefa5f124a91c6f7aa654fe901f826dc7984b63164
parent67117bf808b8348a103f91ca64749d46de3f2db5 (diff)
parent848e4454bf3992a5954aabc4f5bb21a0a695198c (diff)
downloadmiasm-7515ea1f0c1b764ece072a4ff6d434da23425b21.tar.gz
miasm-7515ea1f0c1b764ece072a4ff6d434da23425b21.zip
Merge pull request #502 from serpilliere/fix_symb_exec
Symbexec: Fix state update
-rw-r--r--miasm2/ir/symbexec.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py
index ab873cfd..c26cd68e 100644
--- a/miasm2/ir/symbexec.py
+++ b/miasm2/ir/symbexec.py
@@ -408,9 +408,14 @@ class SymbolicExecutionEngine(object):
                 for new_mem, new_val in diff_mem:
                     self.symbols[new_mem] = new_val
         src_o = self.expr_simp(src)
-        if dst != src_o:
-            # Avoid X = X
-            self.symbols[dst] = src_o
+
+        # Force update. Ex:
+        # EBX += 1 (state: EBX = EBX+1)
+        # EBX -= 1 (state: EBX = EBX, must be updated)
+        self.symbols[dst] = src_o
+        if dst == src_o:
+            # Avoid useless X = X information
+            del self.symbols[dst]
         if isinstance(dst, m2_expr.ExprMem):
             if self.func_write and isinstance(dst.arg, m2_expr.ExprInt):
                 self.func_write(self, dst, src_o)