diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-06-06 15:04:16 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-06-14 09:57:12 +0200 |
| commit | cc20c7ff0680986a63bbed3bd644bf9d3a5ef3ab (patch) | |
| tree | 08ea46284351fef15c0403ff2c119150815134ba | |
| parent | 10888115aa12ecab6354c3cadddebae981ae9671 (diff) | |
| download | miasm-cc20c7ff0680986a63bbed3bd644bf9d3a5ef3ab.tar.gz miasm-cc20c7ff0680986a63bbed3bd644bf9d3a5ef3ab.zip | |
Symbexec: fix expr lookup
| -rw-r--r-- | miasm2/ir/symbexec.py | 2 | ||||
| -rw-r--r-- | miasm2/jitter/emulatedsymbexec.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index 55335504..e98744c0 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -268,6 +268,8 @@ class SymbolicExecutionEngine(object): 2. simplify """ + expr = self.expr_simp(expr) + #print '\t'*level, "Eval:", expr if expr in cache: ret = cache[expr] diff --git a/miasm2/jitter/emulatedsymbexec.py b/miasm2/jitter/emulatedsymbexec.py index d4a67fe8..97f038dc 100644 --- a/miasm2/jitter/emulatedsymbexec.py +++ b/miasm2/jitter/emulatedsymbexec.py @@ -105,6 +105,8 @@ class EmulatedSymbExec(SymbolicExecutionEngine): """Handle 'segm' operation""" if not expr.is_op_segm(): return expr + if not expr.args[0].is_int(): + return expr segm_nb = int(expr.args[0]) segmaddr = self.cpu.get_segm_base(segm_nb) return e_s(m2_expr.ExprInt(segmaddr, expr.size) + expr.args[1]) @@ -114,7 +116,9 @@ class EmulatedSymbExec(SymbolicExecutionEngine): if expr.op != "cpuid": return expr - a, reg_num = (int(x) for x in expr.args) + if any(not arg.is_int() for arg in expr.args): + return expr + a, reg_num = (int(arg) for arg in expr.args) # Not found error is keeped on purpose return m2_expr.ExprInt(self.cpuid[a][reg_num], expr.size) |