From f12ee0b91cf6d4d5a899ebe601bbb089f74f63c4 Mon Sep 17 00:00:00 2001 From: Eric Hennenfent Date: Tue, 30 Oct 2018 17:56:18 -0500 Subject: 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 version 13> >>> type(bv.get_functions_at(here)[0].medium_level_il.ssa_form[96].src[0].src) >>> bv.get_functions_at(here)[0].medium_level_il.ssa_form[96].src[0].src == 'rax_2' Traceback (most recent call last): File "", line 1, in 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' ``` --- python/mediumlevelil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/mediumlevelil.py') 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 "" % (repr(self.var), self.version) def __eq__(self, other): - return ( + return isinstance(other, SSAVariable) and ( (self.var, self.version) == (other.var, other.version) ) -- cgit v1.3.1