Skip to content

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

Open
abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:feat/find-hash-lookup-bounds
Open

abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:feat/find-hash-lookup-bounds

Conversation

@abnalstlll-byte

Copy link
Copy Markdown
Contributor

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.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified at head b01f4c3: the focused suite is 12 passed; the same test on base source fails four checks. Section sizes are clamped to the file and invalid window and top values are rejected. Approving. AI-assisted (OpenCode).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants