diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-03-16 15:02:50 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-03-16 15:02:50 +0100 |
| commit | 848e4454bf3992a5954aabc4f5bb21a0a695198c (patch) | |
| tree | fa5f124a91c6f7aa654fe901f826dc7984b63164 | |
| parent | 67117bf808b8348a103f91ca64749d46de3f2db5 (diff) | |
| download | miasm-848e4454bf3992a5954aabc4f5bb21a0a695198c.tar.gz miasm-848e4454bf3992a5954aabc4f5bb21a0a695198c.zip | |
Symbexec: Fix state update
| -rw-r--r-- | miasm2/ir/symbexec.py | 11 |
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) |