diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2020-01-27 00:01:55 -0500 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2020-01-27 00:01:55 -0500 |
| commit | d13130eb6da9cfce5f0d09f311394ba3d90a6e03 (patch) | |
| tree | dcf8a1ea537479cba00c6c84b6ae7077f1dfbc11 /python/mediumlevelil.py | |
| parent | 9255f56b16bb25a2f966d3980a3370bb924bf1c2 (diff) | |
add negative block indexing for fn, mlil, and llil
Diffstat (limited to 'python/mediumlevelil.py')
| -rw-r--r-- | python/mediumlevelil.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index ef858f3b..ba352503 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -905,8 +905,10 @@ class MediumLevelILFunction(object): # for backwards compatibility if isinstance(i, MediumLevelILInstruction): 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 MediumLevelILInstruction(self, core.BNGetMediumLevelILIndexForInstruction(self.handle, i), i) def __setitem__(self, i, j): |
