erocarrera / pefile

pefile is a Python module to read and work with PE (Portable Executable) files
MIT License
1.86k stars 519 forks source link

local variable 'format' referenced before assignment pefile.py:parse_directory_load_config() #155

Open dilyanpalauzov opened 7 years ago

dilyanpalauzov commented 7 years ago

From pefile.py:parse_directory_load_config I get

Exception Type: UnboundLocalError at /api/samples/ Exception Value: local variable 'format' referenced before assignment

when self.PE_TYPE is neither OPTIONAL_HEADER_MAGIC_PE nor OPTIONAL_HEADER_MAGIC_PE_PLUS. In deed, inthis case the local variable 'format' does not exist, but its existence is required by the following code, and UnboundLocalError is not handled.

bernhl commented 7 years ago

Similar to (but not a duplicate) https://github.com/erocarrera/pefile/issues/194