mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #28] [MERGED] OLD-5600: meshlet_page: reject 0-meshlet groups so the page walk terminates; fix u16 running sums and non-finite positions #80
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#80
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/28
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:meshlet-zero-group📝 Commits (2)
77caf52meshlet_page: fix u16 running-sum wraparound, non-finite crashes, and 0-meshlet groupseef19dameshlet_page: page walk over a 0-meshlet group terminates, guarded by a regression test📊 Changes
2 files changed (+163 additions, -22 deletions)
View changed files
📝
tests/test_meshlet_page.py(+116 -0)📝
tools/meshlet_page.py(+47 -22)📄 Description
Claimed in the coordination issue as: OLD-5600 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964)
What and why
Fixes old #5600: a meshlet group whose header says 0 meshlets (
0x80000000, 0, 0) passedparse_groupand ended 12 bytes in. When the next byte was non-zero,parse_pagerounded the position back down to the same 16-byte boundary and re-parsed the same header forever.parse_groupnow rejects a 0-meshlet group (has no meshlets), sois_mesh_pageis false for such a page, and a mid-page one becomes a normal error or anon-mesh datastop.This carries old PR branch
old-pr/10066by ShotTechOp, cherry-picked onto main with authorship kept. Nothing on main had touched these files since that branch was cut. I checked each of its three fixes against main, and each new test fails there:parse_grouponly compares the low 16 bits of the running sums, but a group can hold up to 2048 meshlets (more than 65536 refs).group_triangles,cone_agreement,centre_agreementandcentre_distanceused the wrapped bases from w1 and read the wrong refs. They now add up the bases themselves.round(nan)andround(inf)raised insidecentre_agreement. NaN also slipped throughmin()/max(), and a cone normal sum that overflowed counted as a cone. Non-finite axes, radii and lengths are now skipped, andcentre_distancereturns None.My follow-up commit adds a
parse_pagetermination test. It covers a page that starts with an empty group and a page where an empty group comes after a valid one. The test runs the walk in a daemon thread with a 10 s join, so if the bug comes back the test fails instead of hanging the suite.Tested
Windows 11, Python 3.11.9, no GPU needed.
0x80000000,0,0,1+ 12 zero bytes) in a subprocess with a 5 s timeout:HANG (timed out after 5s). On this branch:PageError('page starts with neither a vertex block nor a meshlet group').python -I tests/test_meshlet_page.py: main's tool with the new tests givesFAILED (failures=5, errors=3), with the termination test failing via its guard. This branch givesRan 71 tests ... OK.test_analyze_4240_full.py(16),test_draw_ownership.py(11),test_missing_input_exit_codes.py(2),test_tool_stdout_encoding.py,test_vertex_types.py(45, 1 skipped),test_vertex_types_wide_group.py(1).python -I scripts/check_no_game_data.py tools/meshlet_page.py tests/test_meshlet_page.py: clean.AI-assisted: yes
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.