robmcmullen / omnivore

Hex editor and debugging emulator, sponsored by the Player/Missile Podcast
Mozilla Public License 2.0
53 stars 7 forks source link

disassembly error when number of instructions decreases #99

Closed robmcmullen closed 7 years ago

robmcmullen commented 7 years ago

I ran into this error when scrolling down a segment to the end:

Traceback (most recent call last):
  File "/noaa/maproom-deps/omnivore/omnivore/utils/wx/bytegrid.py", line 55, in Draw
    text, style = self.table.get_value_style(row, col)
  File "/noaa/maproom-deps/omnivore/omnivore/tasks/hex_edit/disassembly.py", line 179, in get_value_style_lower
    line = self.lines[row]
  File "udis/udis_fast/disasm_info.pyx", line 75, in udis.udis_fast.disasm_info.DisassemblyInfo.__getitem__ (udis_fast/disasm_info.c:2128)
    raise IndexError("Index %d invalid; number of instructions = %d" % (index, self.num_instructions))
IndexError: Index 1524 invalid; number of instructions = 1508

but haven't been able to reproduce it. I think it had something to do with switching segments? Keeping this stack trace for posterity in case I run into it again.

robmcmullen commented 7 years ago

It seems to happen sometimes when the new segment is smaller than the old segment. Maybe there's a cached value not being updated?

robmcmullen commented 7 years ago

Found the real problem: selecting a group of bytes, then changing the disassembler for that group to something that results in fewer instructions causes there to be extra rows at the end of the table that don't point to valid instructions