diff options
| author | cixotdev <339371196+cixotdev@users.noreply.github.com> | 2026-11-22 21:20:30 -0300 |
|---|---|---|
| committer | cixotdev <339371196+cixotdev@users.noreply.github.com> | 2026-11-22 21:20:30 -0300 |
| commit | 5f1d88ef293b3d48d3730870b4eebfb45e93e621 (patch) | |
| tree | 3b63e3d6c2fcf2c2cc78e4e7215e48db2da0584e /runtime/src | |
| parent | aa2988cc555bad7ecd508b48a702adbb32fe7c95 (diff) | |
tools/pe_inspect: bound strings and directory reads to one section
Clamp PeImage.string_at() and multi-byte table/directory lookups to the
containing header or mapped section span so entries or unterminated
strings cannot read across into an unmapped raw tail or the next section.
- Add PeImage._range() and check full item width in thunk_names(),
_exports(), _export_module_name(), and _tls_callbacks(), while still
raising PeFormatError when a truncated file ends mid-export or mid-TLS
directory.
- Clamp PeImage.string_at() to the mapped byte range of its header or
section.
- Stop masking non-ordinal PE32+ thunk RVAs with 0x7FFFFFFF so invalid
high bits resolve to "?" instead of aliasing low hint/name entries.
- Add synthetic two-section and PE32+ regression tests in
tests/test_pe_inspect.py.
Claim: https://github.com/ItsNotRexed/Leonida/issues/4084#issuecomment-7088230651
AI-assisted: yes (Antigravity)
Diffstat (limited to 'runtime/src')
0 files changed, 0 insertions, 0 deletions