about summary refs log tree commit diff stats
path: root/miasm2/ir/symbexec.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2017-02-02 10:07:22 +0100
committerAjax <commial@gmail.com>2017-02-02 10:07:22 +0100
commit98cf4c23f1cebe1e104f640307bebc679814b785 (patch)
tree549a059bd6e7de718e41b3adb355724191885ec2 /miasm2/ir/symbexec.py
parent54f81c62f9b02ff9af843f2d40753efc19297228 (diff)
downloadmiasm-98cf4c23f1cebe1e104f640307bebc679814b785.tar.gz
miasm-98cf4c23f1cebe1e104f640307bebc679814b785.zip
Apply func_read in case of splitted memory accesses
 If @64[addr] is asked, with @8[addr] = X already known, the resulting
 ExprCompose will look like {X, @56[addr + 1]}. With this PR, func_read
 is applied to the last part, if needed
Diffstat (limited to '')
-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 fd8413fc..80ec7af0 100644
--- a/miasm2/ir/symbexec.py
+++ b/miasm2/ir/symbexec.py
@@ -146,6 +146,8 @@ class symbexec(object):
                 for slice_start, slice_stop in missing_slice:
                     ptr = self.expr_simp(ptr + m2_expr.ExprInt(slice_start / 8, ptr.size))
                     mem = m2_expr.ExprMem(ptr, slice_stop - slice_start)
+                    if self.func_read and ptr.is_int():
+                        mem = self.func_read(mem)
                     out.append((mem, slice_start, slice_stop))
                 out.sort(key=lambda x: x[1])
                 args = [expr for (expr, _, _) in out]
@@ -154,7 +156,7 @@ class symbexec(object):
                 return tmp
 
 
-            if self.func_read and isinstance(ptr, m2_expr.ExprInt):
+            if self.func_read and ptr.is_int():
                 return self.func_read(expr)
             else:
                 return expr
@@ -167,8 +169,11 @@ class symbexec(object):
             while rest:
                 mem = self.find_mem_by_addr(ptr)
                 if mem is None:
-                    value = m2_expr.ExprMem(ptr, 8)
-                    mem = value
+                    mem = m2_expr.ExprMem(ptr, 8)
+                    if self.func_read and ptr.is_int():
+                        value = self.func_read(mem)
+                    else:
+                        value = mem
                     diff_size = 8
                 elif rest >= mem.size:
                     value = self.symbols[mem]