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

2021.9.2 regression: Chained function entry cannot be changed

The-Compiler opened this issue · comments

When trying to load qutebrowser.exe from its latest release with pefile 2021.9.2, it seems to fail:

>>> import pefile
>>> pe = pefile.PE("qutebrowser.exe")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 2742, in __init__
    self.__parse__(name, data, fast_load)
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 3147, in __parse__
    self.full_load()
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 3258, in full_load
    self.parse_data_directories()
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 3553, in parse_data_directories
    value = entry[1](dir_entry.VirtualAddress, dir_entry.Size)
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 3646, in parse_exceptions_directory
    rf.unwindinfo.set_chained_function_entry(
  File "/home/florian/tmp/qutebrowser-2.3.1-x64/.venv/lib/python3.9/site-packages/pefile.py", line 1945, in set_chained_function_entry
    raise Exception("Chained function entry cannot be changed")
Exception: Chained function entry cannot be changed

Downgrading to 2021.5.24 makes things work fine again.

Thanks for reporting. It appears to be related to the recently added parsing of the exception directory. Will take a look.