mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #887] [CLOSED] find_hash_lookup: refuse truncated PE buffers with ValueError (HASHLOOKUP-SHORT-PE) #925
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#925
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/887
Author: @morodirule
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:fix/hashlookup-short-pe📝 Commits (3)
ba1ed04find_hash_lookup: refuse truncated PE buffers with ValueError (HASHLOOKUP-SHORT-PE)ff9acc1find_hash_lookup: require the full 20-byte COFF header (HASHLOOKUP-SHORT-PE)9e4db47find_hash_lookup: reject a truncated optional header with no sections📊 Changes
2 files changed (+28 additions, -0 deletions)
View changed files
📝
tests/test_find_hash_lookup.py(+20 -0)📝
tools/find_hash_lookup.py(+8 -0)📄 Description
Claimed in the coordination issue as: HASHLOOKUP-SHORT-PE
Carries abnalstlll-byte's finding: sections() ran struct.unpack_from(data, 0x3C) unchecked, so MZ-prefixed buffers under 64 bytes raised struct.error instead of the file's ValueError convention (the CLI maps ValueError to a clean exit-2 ERROR line).
Change: length guards before the e_lfanew, COFF-header and per-record section-table reads in tools/find_hash_lookup.py, plus test_a_truncated_image_is_refused_clearly in tests/test_find_hash_lookup.py (short MZ buffers, cut-off COFF, cut-off section record).
Complements open #696 (section-size clamping + --window/--top validation, different lines).
Tests: python -I tests/test_find_hash_lookup.py 6/6 OK; check_no_game_data.py PASS; compileall PASS. Linux x86-64, stdlib only. No game files, no GPU, nothing online.
AI-assisted.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.