summaryrefslogtreecommitdiff
path: root/python/lowlevelil.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2020-01-27 00:01:55 -0500
committerJordan Wiens <jordan@psifertex.com>2020-01-27 00:01:55 -0500
commitd13130eb6da9cfce5f0d09f311394ba3d90a6e03 (patch)
treedcf8a1ea537479cba00c6c84b6ae7077f1dfbc11 /python/lowlevelil.py
parent9255f56b16bb25a2f966d3980a3370bb924bf1c2 (diff)
add negative block indexing for fn, mlil, and llil
Diffstat (limited to 'python/lowlevelil.py')
-rw-r--r--python/lowlevelil.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 4d4ca2ec..87400b4d 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -1304,8 +1304,10 @@ class LowLevelILFunction(object):
# for backwards compatibility
if isinstance(i, LowLevelILInstruction):
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 LowLevelILInstruction(self, core.BNGetLowLevelILIndexForInstruction(self.handle, i), i)
def __setitem__(self, i, j):