find_hash_lookup: validate scan window and result limit #2206

Closed
github-bot wants to merge 1 commit from github-bot/gh-2206 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-26 05:52 UTC · original
whoalin1:hashlookup-args-validation → main · +50 −1 · 2 files · 1 commits · closed without merging

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.

**@⁠whoalin1** on GitHub · 2026-11-26 05:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2206) `whoalin1:hashlookup-args-validation` → `main` · +50 −1 · 2 files · 1 commits · closed without merging ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:22:17 +00:00
Author
Owner

@⁠real-rusher on GitHub · 2026-11-26 10:06 UTC · original

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)

**@⁠real-rusher** on GitHub · 2026-11-26 10:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2206#issuecomment-7188915049) 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)
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-26 10:50 UTC · original

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.)

**@⁠DeadlyChirp** on GitHub · 2026-11-26 10:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2206#issuecomment-7189902307) 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.)
github-bot closed this pull request 2026-11-26 13:33:27 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-26 13:28 UTC · original

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

**@⁠whoalin1** on GitHub · 2026-11-26 13:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2206#issuecomment-7193393550) Consolidated into #2203 as cherry-pick `a33822ab2` to reduce review noise. The scan-window/result-limit validation and regression tests are preserved there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.