find_hash_lookup: validate scan window and result limit #2206

Closed
leonida/mandy
whoalin1 wants to merge 0 commits from hashlookup-args-validation into main

Pull request closed

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

whoalin1 commented 2026-11-26 05:52:58 +00:00

Summary

  • reject a negative --window and a non-positive --top with ValueError, which the CLI already turns into a clean exit-2 error
  • clamp each PE section's declared raw size to the bytes actually present before scanning or computing section coverage
  • add synthetic regressions for direct rank() validation, CLI exit behavior, zero-window behavior and truncated raw sections

Item: TEST-FIND-HASH-LOOKUP-ARGS

This carries forward the still-uncarried fix in old-pr/9792, originally written by abnalstlll-byte, reapplied and verified on current main.

Tests

Under the local machine coordination lock:

  • before the fix, the new tests fail: negative window and non-positive top are accepted, bad CLI arguments do not produce the intended exit-2 error, and the raw-section size is not clamped
  • after the fix: python -I tests/test_find_hash_lookup.py — 10 tests, OK
  • python -m compileall -q tools/find_hash_lookup.py tests/test_find_hash_lookup.py — pass
  • git diff --check — pass

No game files or GPU.

AI-assisted with Devin.

## Summary - reject a negative `--window` and a non-positive `--top` with `ValueError`, which the CLI already turns into a clean exit-2 error - clamp each PE section's declared raw size to the bytes actually present before scanning or computing section coverage - add synthetic regressions for direct `rank()` validation, CLI exit behavior, zero-window behavior and truncated raw sections Item: TEST-FIND-HASH-LOOKUP-ARGS This carries forward the still-uncarried fix in old-pr/9792, originally written by abnalstlll-byte, reapplied and verified on current main. ## Tests Under the local machine coordination lock: - before the fix, the new tests fail: negative `window` and non-positive `top` are accepted, bad CLI arguments do not produce the intended exit-2 error, and the raw-section size is not clamped - after the fix: `python -I tests/test_find_hash_lookup.py` — 10 tests, OK - `python -m compileall -q tools/find_hash_lookup.py tests/test_find_hash_lookup.py` — pass - `git diff --check` — pass No game files or GPU. AI-assisted with Devin.
real-rusher commented 2026-11-26 10:06:23 +00:00

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_find_hash_lookup.py: 10 tests OK. The PR's test file against main's tools/find_hash_lookup.py: 7 failures, so the new tests fail on main and pass with the fix. compileall clean.

AI-assisted: yes (Claude Code)

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_find_hash_lookup.py: 10 tests OK. The PR's test file against main's tools/find_hash_lookup.py: 7 failures, so the new tests fail on main and pass with the fix. compileall clean. AI-assisted: yes (Claude Code)
DeadlyChirp commented 2026-11-26 10:50:13 +00:00

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_find_hash_lookup.py: 10 passed, 5 subtests passed (main: 5 passed).

(AI-assisted test run; output checked by hand.)

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_find_hash_lookup.py`: 10 passed, 5 subtests passed (main: 5 passed). (AI-assisted test run; output checked by hand.)
whoalin1 commented 2026-11-26 13:28:10 +00:00

Consolidated into #2203 as cherry-pick a33822ab2 to reduce review noise. The scan-window/result-limit validation and regression tests are preserved there.

Consolidated into #2203 as cherry-pick `a33822ab2` to reduce review noise. The scan-window/result-limit validation and regression tests are preserved there.
Sign in to join this conversation.
No description provided.