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

Parsing failure due to #365 #421

Open Javagedes opened 1 month ago

Javagedes commented 1 month ago

Hello, #365 with the latest release (2024.8.26) is resulting in a runtime parsing error for some UEFI binaries. I've attached a dump that contains one such binary, it's PDB, and it's MAP file. This binary is built using clang 18.1.5 on Windows. I've also provided the build command, so that you can see all flags used to generate the binary.

File "C:\Users\joeyvagedes\.virtualenvs\mu_tiano_platforms-hKhfHhJg\Lib\site-packages\pefile.py", line 4601, in parse_debug_directory
    dbg_type.ExDllCharacteristics,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ExDllCharacteristics'

dump.zip

Build command

"C:\LLVM\bin\\clang" -MMD -MF c:\src\mu_tiano_platforms\Build\QemuSbsaPkg\DEBUG_CLANGPDB\AARCH64\MdeModulePkg\Bus\Pci\XhciDxe\XhciDxe\OUTPUT\AutoGen.obj.deps -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -fstack-protector -mstack-protector-guard=global -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=XhciDxeStrings -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access -Wno-microsoft-enum-forward-reference -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-exceptions -m64 -mno-red-zone -mcmodel=small -Oz -flto -target aarch64-unknown-windows-gnu -gcodeview -funwind-tables -Wno-unused-but-set-variable -Wno-deprecated-non-prototype -Wno-constant-conversion -DDISABLE_NEW_DEPRECATED_INTERFACES -c -o c:\src\mu_tiano_platforms\Build\QemuSbsaPkg\DEBUG_CLANGPDB\AARCH64\MdeModulePkg\Bus\Pci\XhciDxe\XhciDxe\OUTPUT\.\AutoGen.obj -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdeModulePkg\Bus\Pci\XhciDxe -Ic:\src\mu_tiano_platforms\Build\QemuSbsaPkg\DEBUG_CLANGPDB\AARCH64\MdeModulePkg\Bus\Pci\XhciDxe\XhciDxe\DEBUG -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg\Include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg\Test\UnitTest\Include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg\Test\Mock\Include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg\Library\MipiSysTLib\mipisyst\library\include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdePkg\Include\AArch64 -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdeModulePkg -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdeModulePkg\Include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdeModulePkg\Test\Mock\Include -Ic:\src\mu_tiano_platforms\MU_BASECORE\MdeModulePkg\Library\BrotliCustomDecompressLib\brotli\c\include c:\src\mu_tiano_platforms\Build\QemuSbsaPkg\DEBUG_CLANGPDB\AARCH64\MdeModulePkg\Bus\Pci\XhciDxe\XhciDxe\DEBUG\AutoGen.c