mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #1991] runtime: guard mesh_limit_refusal workgroup invocation product against uint64 overflow (RT-VULKAN-MESH-LIMITS-OVERFLOW) #1998
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#1998
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/1991
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-vulkan-mesh-limits-overflow📝 Commits (1)
7bfc32cruntime: guard mesh_limit_refusal workgroup invocation product against uint64 overflow📊 Changes
2 files changed (+25 additions, -2 deletions)
View changed files
📝
runtime/src/vulkan_mesh_limits.h(+5 -2)📝
runtime/test/vulkan_mesh_limits_test.cpp(+20 -0)📄 Description
Item ID:
RT-VULKAN-MESH-LIMITS-OVERFLOW(claimed in #1608)Summary
In
mesh_limit_refusal()(runtime/src/vulkan_mesh_limits.h), the workgroup invocation check computedstd::uint64_t(n[0]) * n[1] * n[2] > limits.maxMeshWorkGroupInvocations. Becausen[0],n[1], andn[2]are 32-bit integers, their 3-way product can exceed 64 bits and wrap around inuint64_t(for example{1<<24, 1<<24, 1<<16}wraps to0), allowing an oversized mesh workgroup to bypass themaxMeshWorkGroupInvocationsrefusal check.xy = uint64_t(n[0]) * n[1], thenn[2] != 0 && (xy > limit || (xy != 0 && n[2] > limit / xy))), matching the division pattern used insubgroup_workgroup_fits()(runtime/src/subgroup_size.h).runtime/test/vulkan_mesh_limits_test.cppwith exact 3D invocation boundary, 2⁶⁴/2⁶⁶ wrap-around,UINT32_MAXboundary, and zero-limit tests.Testing & Disclosure
clang++ -std=c++20 -g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer -Wall -Wextra -Werror -Wno-missing-field-initializers -I<vulkan-headers> runtime/test/vulkan_mesh_limits_test.cpp: PASSclang++ -std=c++20 -g -O1 -fsanitize=thread -fno-omit-frame-pointer -Wall -Wextra -Werror -Wno-missing-field-initializers -I<vulkan-headers> runtime/test/vulkan_mesh_limits_test.cpp: PASSclang++ -std=c++20 -O2 -Wall -Wextra -Werror -Wno-missing-field-initializers -I<vulkan-headers> runtime/test/vulkan_mesh_limits_test.cpp: PASSpython3 -I scripts/check_no_game_data.py runtime/src/vulkan_mesh_limits.h runtime/test/vulkan_mesh_limits_test.cpp: PASSpython3 -I tests/test_text_write_line_endings.py: PASS (3/3)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.