mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #923] [MERGED] arena_size: a negative LEONIDA_ARENA_MB clamps to the 16 MiB floor, not the 4095 MiB maximum (ARENA-NEGATIVE-MB) #961
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#961
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/923
Author: @TuroYT
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/arena-negative-mb📝 Commits (1)
49e6392arena_size: parse LEONIDA_ARENA_MB as signed so negatives hit the floor (ARENA-NEGATIVE-MB)📊 Changes
2 files changed (+7 additions, -1 deletions)
View changed files
📝
runtime/src/arena_size.h(+4 -1)📝
runtime/test/arena_size_test.cpp(+3 -0)📄 Description
Claimed in the coordination issue as: ARENA-NEGATIVE-MB (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135560869)
What was wrong
runtime/src/arena_size.h:63parsedLEONIDA_ARENA_MBwithstd::strtoull. A negative number wraps to a hugeunsigned value, so
std::clampreturned the 4095 MiB maximum. The header comment documents a clamp to 16..4095 MiB,and a negative number should reach the 16 MiB floor.
Reproduction on
origin/main(g++ 16,-std=c++20 -fsanitize=address,undefined, a probe callingdecide_arena_sizewith an emptyArenaLimits):What changed
runtime/src/arena_size.h: parse withstd::strtolland clamp as a signed value before converting toVkDeviceSize. Negative text now reaches the 16 MiB floor. Every other input keeps its result.runtime/test/arena_size_test.cpp: three new checks inrequest_without_limits:"-5"gives 16 MiB,"-99999999999999999999"gives 16 MiB,"99999999999999999999"gives 4095 MiB.Tested
g++ -std=c++20 -Wall -Wextra -fsanitize=address,undefined -I runtime/src -I <dir with vulkan/ and vk_video/> runtime/test/arena_size_test.cppthen run the binary: builds with no warnings, prints the summary line, exit 0.clang++: exit 0. It prints three-Wmissing-field-initializerswarnings fromquery_arena_limits(lines 34 to 36), which this change does not touch.origin/mainheader: fails withline 32: decide_arena_size("-5", none).bytes == 16 * MiB, exit 1.-5,-1,-0,-5,-99999999999999999999andabcgive 16 MiB;99999999999999999999and99999give 4095 MiB;+20gives 20 MiB;0x20gives 16 MiB.python3 -I scripts/check_no_game_data.py runtime/src/arena_size.h runtime/test/arena_size_test.cpp: exit 0.git diff --check: clean.Not tested
arena_sizeon Windows.cteston Linux for the whole runtime tree (only the single test file was built and run).runtime/shims/d3d12_vulkan_device.cpp.origin/mainheader ran one at a time through the probe. The test stops at its firstfailing check (line 32), so the huge-negative check was not reached by the test binary on the unfixed header.
AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.