From 67c7f90a4c701be78d03f66e4e6d3be8eb95236d Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 25 Aug 2022 19:08:45 -0400 Subject: Fix LowLevelILConstantBase __eq__ against unexpected types --- python/lowlevelil.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'python') diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 7733fdcc..c6ee2b4a 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -1073,21 +1073,33 @@ class LowLevelILConstantBase(LowLevelILInstruction, Constant): return self.constant != 0 def __eq__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant == other.constant def __ne__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant != other.constant def __lt__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant < other.constant def __gt__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant > other.constant def __le__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant <= other.constant def __ge__(self, other: 'LowLevelILConstantBase'): + if not isinstance(other, self.__class__): + return NotImplemented return self.constant >= other.constant def __hash__(self): -- cgit v1.3.1