about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/ir/symbexec.py2
-rw-r--r--miasm2/jitter/emulatedsymbexec.py6
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)