mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1699] title_va_alias: guard null add(), in-range gap(), empty title_overlap_end(), and bad_alloc #1714
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#1714
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/1699
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/title-va-alias-range-and-gap-guards📝 Commits (1)
0e3a9a4title_va_alias: guard null add(), in-range gap(), empty title_overlap_end(), and bad_alloc📊 Changes
2 files changed (+88 additions, -15 deletions)
View changed files
📝
runtime/src/title_va_alias.h(+30 -14)📝
runtime/test/title_va_alias_test.cpp(+58 -1)📄 Description
Item ID:
TITLE-VA-ALIAS-RANGE-AND-GAP-GUARDSClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7157362802
Summary
Hardens
leonida::TitleVaAliasesinruntime/src/title_va_alias.hand adds regressions toruntime/test/title_va_alias_test.cpp:title_vainadd(): matchesadd_title_memory(),resolve(),note(), andwant_buffer()(previouslyadd(0, size, arena)inserted a range at 0, makingshader_va(0)non-zero whileresolve(0)returned 0).[va, va)fromgap(va, lo, hi)whenvalies inside an existing range: previouslylowas set toprev->second.end > va, breakinglo <= va <= hiand allowing callers that clamp a window aroundvato underflowend - start.0fromtitle_overlap_end(lo, hi)whenlo >= hi: empty/inverted half-open intervals[lo, hi)previously reported an overlap wheneverlolay inside a title memory range.add()andadd_title_memory(): pre-allocate the replacementstd::mapnode viaextract()before erasing overlapping entries, sostd::bad_allocnever leavesranges_/memory_partially erased orcount_out of sync withranges_.size().Verification
clang++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic -fsanitize=undefined runtime/test/title_va_alias_test.cpp-> exit 0, all checks pass, 0 warnings / 0 UBSan issues.Mutation check against unpatched
main(git show main:runtime/src/title_va_alias.hwith updatedtitle_va_alias_test.cpp) -> exit 1 (!a.add(0, size, arena)fails immediately;gap(),title_overlap_end(), and bothbad_allocchecks also fail on unpatchedmain).python3 -I scripts/check_no_game_data.py runtime/src/title_va_alias.h runtime/test/title_va_alias_test.cpp-> OK.python3 -m compileall -q make_game.py tools testsandpython3 -I tests/test_text_write_line_endings.py-> OK (3/3).AI-assisted: yes
GPUs tested: none (CPU-only portable
title_va_alias_test; no game files)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.