Vector35 / deprecated-binaryninja-python

Deprecated Binary Ninja prototype written in Python
GNU General Public License v2.0
518 stars 128 forks source link

Elf Viewer can't display ELF file with only section headers and no program headers #13

Open zhuowei opened 8 years ago

zhuowei commented 8 years ago

I have an ELF file that was converted from RPL (the Wii U's modified ELF format); when trying to view its information in Elf Viewer, I get a blank screen with the following error in the console:

Traceback (most recent call last):
  File "binja.py", line 803, in setView
    self.focus_tab.widget(self.focus_tab.currentIndex()).setViewType(type)
  File "/home/zhuowei/binaryninja-python/View.py", line 100, in setViewType
    view = self.createView(type)
  File "/home/zhuowei/binaryninja-python/View.py", line 84, in createView
    view = type(self.data, self.filename, self, self.main_area)
  File "/home/zhuowei/binaryninja-python/ElfFile.py", line 507, in __init__
    super(ElfViewer, self).__init__(view.exe, filename, view, parent)
  File "/home/zhuowei/binaryninja-python/HexEditor.py", line 61, in __init__
    self.status = "Cursor: 0x%.8x" % self.data.start()
TypeError: %x format: a number is required, not NoneType

I'm on Ubuntu 14.04 (32-bit) and using the latest version from the master branch.

The readelf output for the ELF file if that helps: https://gist.github.com/zhuowei/45d1eb080bc36dc34237

As one can see, there are no program headers in the file at all (RPLs are loaded through the section headers), so ElfFile.start() can't find a start address from the program headers and will return None.