find_hash_lookup: clamp raw section sizes and validate window and top parameters (OLD-9792) #696

Closed
leonida/mandy
abnalstlll-byte wants to merge 0 commits from feat/find-hash-lookup-bounds into main

Pull request closed

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

abnalstlll-byte commented 2026-11-24 12:17:05 +00:00

Related issues: #14, #17, #18 (restoring old upstream PR 9792, author restoration for draft PR #70).

What and why

Restores original pull request OLD-9792 authored by @abnalstlll-byte:

  • Enforces strict section size clamping in \ ools/find_hash_lookup.py\ to prevent out-of-bounds slicing on truncated PE sections.
  • Validates --window\ and --top\ parameters against non-positive integers, returning clear command-line error messages.
  • Comprehensive unit test coverage in \ ests/test_find_hash_lookup.py\ (12/12 PASS).

Tested

  • Windows 11 x64, Python 3.14 / 3.12:
    • \python -I tests/test_find_hash_lookup.py: 12/12 PASS.
    • \python -I scripts/check_no_game_data.py\ on changed files: PASS.
  • Clean merge against \ubi/main\ (0 conflicts).

Checklist

  • No proprietary payloads, game-derived files, keys, or protection workarounds.
  • Standard library only (\python -I).
  • Preserves author attribution and original PR commit provenance.
Related issues: #14, #17, #18 (restoring old upstream PR 9792, author restoration for draft PR #70). ### What and why Restores original pull request **OLD-9792** authored by @abnalstlll-byte: - Enforces strict section size clamping in \ ools/find_hash_lookup.py\ to prevent out-of-bounds slicing on truncated PE sections. - Validates \--window\ and \--top\ parameters against non-positive integers, returning clear command-line error messages. - Comprehensive unit test coverage in \ ests/test_find_hash_lookup.py\ (12/12 PASS). ### Tested - Windows 11 x64, Python 3.14 / 3.12: - \python -I tests/test_find_hash_lookup.py\: 12/12 PASS. - \python -I scripts/check_no_game_data.py\ on changed files: PASS. - Clean merge against \ubi/main\ (0 conflicts). ### Checklist - [x] No proprietary payloads, game-derived files, keys, or protection workarounds. - [x] Standard library only (\python -I\). - [x] Preserves author attribution and original PR commit provenance.
abnalstlll-byte commented 2026-11-25 21:34:51 +00:00

Rebased cleanly onto latest \main\ (\e34ff17e9), clearing stale base CI failures. Verified: all 12 tests in \ est_find_hash_lookup.py\ pass.

AI-assisted (Claude Code)

Rebased cleanly onto latest \main\ (\e34ff17e9\), clearing stale base CI failures. Verified: all 12 tests in \ est_find_hash_lookup.py\ pass. AI-assisted (Claude Code)
MoonEyes commented 2026-11-27 23:36:16 +00:00

Thanks for this, @abnalstlll-byte. #1268, opened by wetw0rks-c0ding for the same item (OLD-9792), contains your commit unchanged as its first commit and adds one commit on top: exact assertions for the section-size clamp and for the rank() argument errors (the truncation test here accepts any outcome), and rank() errors that name the parameter while the CLI still prints --window and --top. Both pull requests change the same two files, so nothing from this one is lost, and your authorship is kept in #1268.

I am closing this one to avoid two pull requests for one item. Please continue in #1268, or reopen this one if something is missing there.

AI-assisted (Claude Code, Claude Opus 5.5)

Thanks for this, @abnalstlll-byte. #1268, opened by `wetw0rks-c0ding` for the same item (OLD-9792), contains your commit unchanged as its first commit and adds one commit on top: exact assertions for the section-size clamp and for the `rank()` argument errors (the truncation test here accepts any outcome), and `rank()` errors that name the parameter while the CLI still prints `--window` and `--top`. Both pull requests change the same two files, so nothing from this one is lost, and your authorship is kept in #1268. I am closing this one to avoid two pull requests for one item. Please continue in #1268, 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.