Skip to content

PE: Load exception tables without pefile. - #886

Merged
ltfish merged 2 commits into
masterfrom
perf/pe-raw-exception-table
Nov 12, 2026
Merged

ltfish merged 2 commits into
masterfrom
perf/pe-raw-exception-table

Conversation

@ltfish

@ltfish ltfish commented Nov 12, 2026

Copy link
Copy Markdown
Member

No description provided.

pefile decodes every UNWIND_INFO in the exception directory, while the backend only needs each
entry's begin and end address. On OUTLOOK.EXE (119,599 entries) that parse took 5.3-5.8 s; reading
the table directly takes 0.02 s. The reader keeps pefile's behavior: AMD64 only, stop at the first
unsupported UNWIND_INFO version, and no entries if an UNWIND_INFO header is unreadable.
pefile only parses x64 exception directories, so ARM64 and ARMNT binaries got no
function hints from .pdata. Read their 8-byte entries directly: the function
length comes from the packed unwind data or the .xdata header (in 4-byte units on
ARM64, 2-byte units on ARMNT), and ARMNT start addresses keep the Thumb bit. As on
AMD64, every entry is kept (fragments included), reading stops at a reserved flag
or an unsupported .xdata version, and an unreadable .xdata header drops the table.

The hints match llvm-readobj --unwind on every entry of the new test binaries
pdata_arm64.exe and pdata_armnt.exe.
@ltfish ltfish self-assigned this Nov 12, 2026
@angr-bot

Copy link
Copy Markdown
Member

Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_886

@ltfish
ltfish merged commit 03fc8cc into master Nov 12, 2026
18 of 20 checks passed
@ltfish
ltfish deleted the perf/pe-raw-exception-table branch November 12, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants