robmcmullen / omnivore

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

Find in disasm crashes #224

Closed robmcmullen closed 7 years ago

robmcmullen commented 7 years ago

Loaded up jumpman, select Code segment, scrolled to 4900 or so, started a find, typed 4 and got:

Traceback (most recent call last):
  File "/noaa/maproom-deps/omnivore/omnivore/framework/minibuffer.py", line 154, in on_text
    self.perform()
  File "/noaa/maproom-deps/omnivore/omnivore/framework/minibuffer.py", line 317, in perform
    self.editor.process_command(cmd)
  File "/noaa/maproom-deps/omnivore/omnivore/framework/editor.py", line 676, in process_command
    undo = self.process_batch_command(command, f, batch)
  File "/noaa/maproom-deps/omnivore/omnivore/framework/editor.py", line 689, in process_batch_command
    undo = self.document.undo_stack.perform(command, self, batch)
  File "/noaa/maproom-deps/omnivore/omnivore/utils/command.py", line 89, in perform
    cmd.perform(editor, undo_info)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/hex_edit/commands.py", line 560, in perform
    searcher = searcher_cls(editor, self.search_text)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/utils/searchutil.py", line 13, in __init__
    self.matches = self.get_matches(editor)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/utils/searchutil.py", line 62, in get_matches
    matches = editor.disassembly.search(self.search_text, editor.last_search_settings.get('match_case', False))
  File "/noaa/maproom-deps/omnivore/omnivore8bit/hex_edit/disassembly.py", line 379, in search
    return self.table.disassembler.search(search_text, match_case)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/arch/disasm.py", line 478, in search
    label_matches = self.search_labels(self.pc_label_cache, search_text, match_case)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/arch/disasm.py", line 178, in pc_label_cache
    self.create_label_caches()
  File "/noaa/maproom-deps/omnivore/omnivore8bit/arch/disasm.py", line 207, in create_label_caches
    text = self.get_dest_pc_label(line.dest_pc)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/arch/disasm.py", line 271, in get_dest_pc_label
    good_opcode_target_pc = self.info.get_instruction_start_pc(target_pc)
  File "udis/udis_fast/disasm_info.pyx", line 93, in udis.udis_fast.disasm_info.DisassemblyInfo.get_instruction_start_pc (udis_fast/disasm_info.c:2787)
    raise IndexError("PC %d out of range: %d - %d" % (pc, self.first_pc, self.first_pc + self.num_bytes))
IndexError: PC 28672 out of range: 8192 - 28672
robmcmullen commented 7 years ago

Maybe related to being the last segment in the file?

robmcmullen commented 7 years ago

Huh, nope. Doesn't seem to be a problem in other files.

robmcmullen commented 7 years ago

Related problem? select last segment in Jumpman (1983)(Epyx)(US)[!].atr

  File "/noaa/maproom-deps/omnivore/omnivore/framework/minibuffer.py", line 163, in on_text
    self.perform()
  File "/noaa/maproom-deps/omnivore/omnivore/framework/minibuffer.py", line 326, in perform
    self.editor.process_command(cmd)
  File "/noaa/maproom-deps/omnivore/omnivore/framework/editor.py", line 676, in process_command
    undo = self.process_batch_command(command, f, batch)
  File "/noaa/maproom-deps/omnivore/omnivore/framework/editor.py", line 689, in process_batch_command
    undo = self.document.undo_stack.perform(command, self, batch)
  File "/noaa/maproom-deps/omnivore/omnivore/utils/command.py", line 89, in perform
    cmd.perform(editor, undo_info)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/hex_edit/commands.py", line 560, in perform
    searcher = searcher_cls(editor, self.search_text)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/utils/searchutil.py", line 13, in __init__
    self.matches = self.get_matches(editor)
  File "/noaa/maproom-deps/omnivore/omnivore8bit/utils/searchutil.py", line 86, in get_matches
    for index, comment in segment.iter_comments_in_segment():
  File "/noaa/maproom-deps/omnivore/atrcopy/segments.py", line 995, in iter_comments_in_segment
    end_index = self.get_raw_index(len(self.rawdata))
  File "/noaa/maproom-deps/omnivore/atrcopy/segments.py", line 582, in get_raw_index
    return self.rawdata.get_raw_index(i)
  File "/noaa/maproom-deps/omnivore/atrcopy/segments.py", line 259, in get_raw_index
    return int(self.order[i])
IndexError: index 40 is out of bounds for axis 0 with size 40