about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-08-07 14:38:43 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-08-08 09:25:57 +0200
commit80b9d2197802c4751d374e3bfd8517d096734cc3 (patch)
treeca5d0ecab56637530a534600c86f68272a1bd24f
parent8330eaecfd17c50c5a26ea3f3a9061f69d0159d4 (diff)
downloadmiasm-80b9d2197802c4751d374e3bfd8517d096734cc3.tar.gz
miasm-80b9d2197802c4751d374e3bfd8517d096734cc3.zip
SymbexecTypes: fix merge
Merge should return the union of types of both states instead of its
intersection.
-rw-r--r--miasm2/ir/symbexec_types.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/miasm2/ir/symbexec_types.py b/miasm2/ir/symbexec_types.py
index a1b3afdf..a8e8bdf2 100644
--- a/miasm2/ir/symbexec_types.py
+++ b/miasm2/ir/symbexec_types.py
@@ -37,15 +37,14 @@ class SymbolicStateCTypes(StateEngine):
 
     def merge(self, other):
         """Merge two symbolic states
-        Only expressions with equal C types in both states are kept.
+        The resulting types are the union of types of both states.
         @other: second symbolic state
         """
         symb_a = self.symbols
         symb_b = other.symbols
-        common_expr = set(symb_a).intersection(symb_b)
         symbols = {}
-        for expr in common_expr:
-            ctypes = symb_a[expr].intersection(symb_b[expr])
+        for expr in set(symb_a).union(set(symb_b)):
+            ctypes = symb_a.get(expr, set()).union(symb_b.get(expr, set()))
             if ctypes:
                 symbols[expr] = ctypes
         return self.__class__(symbols)