[PR #70] find_hash_lookup: clamp raw section sizes and validate window and top parameters #121

Open
opened 2026-11-26 20:16:52 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/70
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/9792


📝 Commits (1)

  • b01f4c3 find_hash_lookup: clamp raw section sizes and validate window and top parameters

📊 Changes

2 files changed (+86 additions, -1 deletions)

View changed files

📝 tests/test_find_hash_lookup.py (+77 -0)
📝 tools/find_hash_lookup.py (+9 -1)

📄 Description

Carried over from old PR 9792 by abnalstlll-byte in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9792, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
abnalstlll-byte: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Bounds validation and section size clamping in \ ools/find_hash_lookup.py.

What and why

\ ools/find_hash_lookup.py\ scans PE sections for hash lookup tables. This PR:

  • Clamps raw section sizes to avoid reading past EOF on truncated inputs.
  • Validates --window\ and --top\ CLI parameters, enforcing positive bounds.
  • Adds comprehensive unit test suite in \ ests/test_find_hash_lookup.py\ (12/12 pass).

Verification

  • \python -I tests/test_find_hash_lookup.py\ -> 12/12 tests pass.
  • \python -I scripts/check_no_game_data.py\ -> clean (zero game data).
  • \git diff --check\ -> clean.
  • Python standard library only, cross-platform compatible.

AI-assisted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/70 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9792` --- ### 📝 Commits (1) - [`b01f4c3`](https://github.com/ubiquitarianism/leonida/commit/b01f4c33797cc69212e10504bea7c2343aa12eaf) find_hash_lookup: clamp raw section sizes and validate window and top parameters ### 📊 Changes **2 files changed** (+86 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_find_hash_lookup.py` (+77 -0) 📝 `tools/find_hash_lookup.py` (+9 -1) </details> ### 📄 Description > Carried over from **old PR 9792** by `abnalstlll-byte` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9792`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `abnalstlll-byte`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Bounds validation and section size clamping in \ ools/find_hash_lookup.py\. ### What and why \ ools/find_hash_lookup.py\ scans PE sections for hash lookup tables. This PR: - Clamps raw section sizes to avoid reading past EOF on truncated inputs. - Validates \--window\ and \--top\ CLI parameters, enforcing positive bounds. - Adds comprehensive unit test suite in \ ests/test_find_hash_lookup.py\ (12/12 pass). ### Verification - \python -I tests/test_find_hash_lookup.py\ -> 12/12 tests pass. - \python -I scripts/check_no_game_data.py\ -> clean (zero game data). - \git diff --check\ -> clean. - Python standard library only, cross-platform compatible. AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#121
No description provided.