mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1636] draw_ownership: enforce pointer segment upper bounds, EOF-bounded hexdump, and integer offset guards #1650
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1650
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1636
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/draw-ownership-bounds-and-hexdump📝 Commits (1)
986798edraw_ownership: enforce pointer segment upper bounds, EOF-bounded hexdump, and integer offset guards📊 Changes
2 files changed (+110 additions, -9 deletions)
View changed files
📝
tests/test_draw_ownership.py(+76 -0)📝
tools/draw_ownership.py(+34 -9)📄 Description
Item ID:
DRAW-OWNERSHIP-BOUNDS-AND-HEXDUMPClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154992847
Summary
Harden pointer range checks, hexdump EOF handling, and offset validation in
tools/draw_ownership.py:PTR_BASE <= raw < GRAPHICS_BASEin_system_pointer()so0x60000000-based graphics pointers and higher values are explicitly rejected as non-system pointers rather than treated as out-of-range system offsets (or accepted on segments >= 256 MiB).reverse_pointers()upper bound atmin(PTR_BASE + len(system), GRAPHICS_BASE)so graphics pointers never become system-segment edges.GRAPHICS_BASE <= raw < GRAPHICS_LIMIT(0x70000000) ingeometry_shape_check()so high/garbage values like0x70000000or0xFFFFFFFF_FFFFFFFFare rejected._hexdump(): stop emitting rows onceat + row >= len(system)(preventing empty trailing rows past EOF inclassify_parent()near segment end), convert slices viabytes(...)somemoryviewworks cleanly, and reject negative offsets/lengths.booland non-intoffsets cleanly withTypeErroracrosswalk_chain(),walk_drawable(),classify_parent(),geometry_shape_check(),_u16()/_u32()/_u64(), and_hexdump(), and reject out-of-range caller-supplied reverse-index entries inclassify_parent().tests/test_draw_ownership.py): addedBoundsAndHexdumpTests(6 test methods).Verification
python3 -W error -I tests/test_draw_ownership.py -v: 17/17 passedmain:ran=17 failures=10 errors=2python3 -I tests/test_text_write_line_endings.py: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/draw_ownership.py tests/test_draw_ownership.py: passedpython3 -m compileall -q tools/draw_ownership.py tests/test_draw_ownership.py: passed🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.