about summary refs log tree commit diff stats
path: root/miasm2/ir/ir.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/ir/ir.py')
-rw-r--r--miasm2/ir/ir.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/miasm2/ir/ir.py b/miasm2/ir/ir.py
index 603d3fd0..afb6b382 100644
--- a/miasm2/ir/ir.py
+++ b/miasm2/ir/ir.py
@@ -469,13 +469,15 @@ class IntermediateRepresentation(object):
         if (isinstance(addr, m2_expr.ExprId) and
                 isinstance(addr.name, AsmLabel)):
             addr = addr.name
-        if isinstance(addr, m2_expr.ExprInt):
+        if isinstance(addr, AsmLabel):
+            return addr
+
+        try:
             addr = int(addr)
-        if isinstance(addr, (int, long)):
-            addr = self.symbol_pool.getby_offset_create(addr)
-        elif isinstance(addr, AsmLabel):
-            addr = self.symbol_pool.getby_name_create(addr.name)
-        return addr
+        except (ValueError, TypeError):
+            return None
+
+        return self.symbol_pool.getby_offset_create(addr)
 
     def get_block(self, addr):
         """Returns the irbloc associated to an ExprId/ExprInt/label/int