summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2019-04-25 14:29:38 -0400
committerJordan Wiens <jordan@psifertex.com>2019-04-25 14:29:38 -0400
commit89f9cb476aa02276a196e9a79ac675f7d15f9d3d (patch)
treec2d0309e29d5d5af313e7a5a5667adec0d9e38cf /python
parent74a30873db76348e57cef1e0b0fe48cb00924a68 (diff)
add type checks for various comparators
Diffstat (limited to 'python')
-rw-r--r--python/lowlevelil.py14
-rw-r--r--python/mediumlevelil.py4
2 files changed, 17 insertions, 1 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 90ecbd74..efa92a7a 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -61,6 +61,8 @@ class ILRegister(object):
return self.name
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return self.info == other.info
@@ -81,6 +83,8 @@ class ILRegisterStack(object):
return self.name
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return self.info == other.info
@@ -114,6 +118,8 @@ class ILSemanticFlagClass(object):
return self.name
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return self.index == other.index
@@ -130,6 +136,8 @@ class ILSemanticFlagGroup(object):
return self.name
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return self.index == other.index
@@ -149,6 +157,8 @@ class ILIntrinsic(object):
return self.name
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return self.index == other.index
@@ -512,6 +522,8 @@ class LowLevelILInstruction(object):
return "<il: %s>" % str(self)
def __eq__(self, value):
+ if not isinstance(value, type(self)):
+ return False
return self.function == value.function and self.expr_index == value.expr_index
@property
@@ -763,7 +775,7 @@ class LowLevelILFunction(object):
core.BNFreeLowLevelILFunction(self.handle)
def __eq__(self, value):
- if not isinstance(value, LowLevelILFunction):
+ if not isinstance(value, type(self)):
return False
return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents)
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index e8d58f96..b6b7dbfc 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -43,6 +43,8 @@ class SSAVariable(object):
return "<ssa %s version %d>" % (repr(self.var), self.version)
def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
return isinstance(other, SSAVariable) and (
(self.var, self.version) ==
(other.var, other.version)
@@ -318,6 +320,8 @@ class MediumLevelILInstruction(object):
return "<il: %s>" % str(self)
def __eq__(self, value):
+ if not isinstance(value, type(self)):
+ return False
return self.function == value.function and self.expr_index == value.expr_index
@property