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

Closed
leonida/mandy
Andretuta wants to merge 0 commits from old-pr/9792 into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Andretuta commented 2026-11-24 02:12:31 +00:00

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.

> 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.
abnalstlll-byte commented 2026-11-24 08:02:54 +00:00

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.

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.
MoonEyes commented 2026-11-27 19:42:36 +00:00

Thanks a lot for carrying this over, @Andretuta. The same change is open in #696, opened by abnalstlll-byte (the original author of old PR 9792) with their commit kept: both pull requests change the same two files with the same lines, so nothing from this draft is lost.

I am closing this draft to keep the queue clear. Please continue the discussion in #696, or reopen this one if something is missing there.

AI-assisted (Claude Code, Claude Opus 5.5)

Thanks a lot for carrying this over, @Andretuta. The same change is open in #696, opened by `abnalstlll-byte` (the original author of old PR 9792) with their commit kept: both pull requests change the same two files with the same lines, so nothing from this draft is lost. I am closing this draft to keep the queue clear. Please continue the discussion in #696, or reopen this one if something is missing there. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.