Avoid attempted reads past end of program image
Previously if what could be a load, store, branch, or call instruction was located within last two bytes of the program image being disassembled, the disassembler would try to read out of bounds to get its address parameter. This change marks such cases as not being valid instructions.
This commit is contained in:
parent
29cb28fa49
commit
110280ed5e
|
@ -45,6 +45,7 @@ def segment(binary, origin):
|
|||
valid = True
|
||||
if not opcodes[opcode].rx and rx != 0: valid = False
|
||||
if not opcodes[opcode].ry and ry != 0: valid = False
|
||||
if opcodes[opcode].addr and ip + 2 >= len(binary): valid = False
|
||||
|
||||
if not valid:
|
||||
raw = binary[ip:ip + 1]
|
||||
|
|
Loading…
Reference in New Issue