summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorEric Hennenfent <ecapstone@gmail.com>2018-10-30 17:56:18 -0500
committerGitHub <noreply@github.com>2018-10-30 17:56:18 -0500
commitf12ee0b91cf6d4d5a899ebe601bbb089f74f63c4 (patch)
tree54f8e1af551432d80b379e3a20debae5044a44db /python
parentcb0c0c57845396814239902b82c93d39ce9192a1 (diff)
Type check SSA variables in __eq__
Instantly bail if we try to compare a SSAVariable to something that isn't an SSA Variable. Prevents the following issue: ``` >>> bv.get_functions_at(here)[0].medium_level_il.ssa_form[96].src[0].src <ssa <var uint64_t rax_2> version 13> >>> type(bv.get_functions_at(here)[0].medium_level_il.ssa_form[96].src[0].src) <class 'binaryninja.mediumlevelil.SSAVariable'> >>> bv.get_functions_at(here)[0].medium_level_il.ssa_form[96].src[0].src == 'rax_2' Traceback (most recent call last): File "<console>", line 1, in <module> File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/mediumlevelil.py", line 48, in __eq__ (other.var, other.version) AttributeError: 'str' object has no attribute 'var' ```
Diffstat (limited to 'python')
-rw-r--r--python/mediumlevelil.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 93c45dcc..103d8c5f 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -43,7 +43,7 @@ class SSAVariable(object):
return "<ssa %s version %d>" % (repr(self.var), self.version)
def __eq__(self, other):
- return (
+ return isinstance(other, SSAVariable) and (
(self.var, self.version) ==
(other.var, other.version)
)