find_hash_lookup: clamp raw section sizes and validate window and top parameters #70

Open
github-bot wants to merge 1 commit from github-bot/gh-70 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:12 UTC · original
ubiquitarianism:old-pr/9792 → main · +86 −1 · 2 files · 1 commits · draft

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.

**@⁠Andretuta** on GitHub · 2026-11-24 02:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/70) `ubiquitarianism:old-pr/9792` → `main` · +86 −1 · 2 files · 1 commits · draft > 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:43:03 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 08:02 UTC · original

Verified clean and ready for review: 12/12 tests pass under python -I tests/test_find_hash_lookup.py, zero game data, clamps raw section sizes and validates window/top parameters.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 08:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/70#issuecomment-7125663238) Verified clean and ready for review: 12/12 tests pass under python -I tests/test_find_hash_lookup.py, zero game data, clamps raw section sizes and validates window/top parameters.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/70/head:github-bot/gh-70'
git switch 'github-bot/gh-70'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-70'
git switch 'github-bot/gh-70'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-70'
git switch 'github-bot/gh-70'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-70'
git switch 'main'
git merge --squash 'github-bot/gh-70'
git switch 'main'
git merge --ff-only 'github-bot/gh-70'
git switch 'main'
git merge 'github-bot/gh-70'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.