erocarrera / pefile

pefile is a Python module to read and work with PE (Portable Executable) files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: PE object has no attribute DIRECTORY_ENTRY_BASERELOC

pd-fkie opened this issue · comments

PE.relocate_image invokes parse_data_directories if the object doesn't have
the attribute DIRECTORY_ENTRY_BASERELOC yet.
However a verification that parse_data_directories actually created
self.DIRECTORY_ENTRY_BASERELOC is missing and the function directly uses
DIRECTORY_ENTRY_BASERELOC resulting in the exception:

AttributeError: 'PE' object has no attribute 'DIRECTORY_ENTRY_BASERELOC'
Traceback (most recent call last):
  File "fuzz_pefile.py", line 22, in TestOneInput
    p.relocate_image(0x40000)
  File "pefile.py", line 5524, in relocate_image
    for reloc in self.DIRECTORY_ENTRY_BASERELOC:

Other functions that use parse_data_directories are not missing this check.


Crash file: crash-8ffa487ba8fe2bc6f6af1e9ba464aea5aba58374