From 3485769f83dbfce783df886689841db3a1544916 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Fri, 21 Aug 2020 08:36:01 -0400 Subject: Allow negative indexing of hlil function --- python/highlevelil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/highlevelil.py b/python/highlevelil.py index e815df48..589d6505 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -804,8 +804,10 @@ class HighLevelILFunction(object): # for backwards compatibility if isinstance(i, HighLevelILInstruction): return i - if (i < 0) or (i >= len(self)): + if i < -len(self) or i >= len(self): raise IndexError("index out of range") + if i < 0: + i = len(self) + i return HighLevelILInstruction(self, core.BNGetHighLevelILIndexForInstruction(self.handle, i), False, i) def __setitem__(self, i, j): -- cgit v1.3.1