[PR #1223] vulkan_present: guard make_capture_buffer against a null memory-properties pointer (RT-PRESENT-CAPTURE-NULLGUARD) #1255

Open
opened 2026-11-26 20:20:37 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1223
Author: @Miici0
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/xbox-present-capture-null-guard


📝 Commits (2)

  • f849034 vulkan_present: guard make_capture_buffer against a null memory-properties pointer
  • 4d3159a vulkan_present: check the memory-properties pointer before creating the buffer

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 runtime/src/vulkan_present.h (+1 -0)

📄 Description

Claimed in the coordination issue as: RT-PRESENT-CAPTURE-NULLGUARD (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143716337)

Depends on: none

Fixes: none

What and why

make_capture_buffer() in runtime/src/vulkan_present.h called vkGetPhysicalDeviceMemoryProperties_(physical_, ...) without checking the function pointer for null first, unlike prepare_compose() right above it, which does guard it. Found while investigating the intermittent xbox_present crash reported in #14 (finding at https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143642803). This does not claim to fix that crash — the root cause there is still unconfirmed (it reproduces only through ctest, at roughly a 2% rate, and disappears under any validation layer or debugger, so it couldn't be caught live after over 100 attempts). This just closes a real null-pointer-call gap found along the way: if the extension function were ever unavailable, this call would crash immediately and unconditionally instead of failing the capture-buffer setup cleanly, as its sibling function already does.

Tested

ctest --test-dir runtime/build -C RelWithDebInfo -R "^xbox_present$": passes (2.99s). Full portable test suite otherwise unaffected (single-line, behavior-preserving guard; the function pointer is non-null in every environment observed, so this only changes behavior in the previously-unguarded null case).

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 26300.9974, Vulkan SDK 1.4.363.1.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • N/A: no new translator rule.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1223 **Author:** [@Miici0](https://github.com/Miici0) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/xbox-present-capture-null-guard` --- ### 📝 Commits (2) - [`f849034`](https://github.com/ubiquitarianism/leonida/commit/f849034a8f4c080d4686e0a422e7519b3cf90cc8) vulkan_present: guard make_capture_buffer against a null memory-properties pointer - [`4d3159a`](https://github.com/ubiquitarianism/leonida/commit/4d3159aba8c75054965414124fb43da55297d329) vulkan_present: check the memory-properties pointer before creating the buffer ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/vulkan_present.h` (+1 -0) </details> ### 📄 Description Claimed in the coordination issue as: RT-PRESENT-CAPTURE-NULLGUARD (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143716337) Depends on: none Fixes: none ### What and why `make_capture_buffer()` in `runtime/src/vulkan_present.h` called `vkGetPhysicalDeviceMemoryProperties_(physical_, ...)` without checking the function pointer for null first, unlike `prepare_compose()` right above it, which does guard it. Found while investigating the intermittent `xbox_present` crash reported in #14 (finding at https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143642803). This does **not** claim to fix that crash — the root cause there is still unconfirmed (it reproduces only through `ctest`, at roughly a 2% rate, and disappears under any validation layer or debugger, so it couldn't be caught live after over 100 attempts). This just closes a real null-pointer-call gap found along the way: if the extension function were ever unavailable, this call would crash immediately and unconditionally instead of failing the capture-buffer setup cleanly, as its sibling function already does. ### Tested `ctest --test-dir runtime/build -C RelWithDebInfo -R "^xbox_present$"`: passes (2.99s). Full portable test suite otherwise unaffected (single-line, behavior-preserving guard; the function pointer is non-null in every environment observed, so this only changes behavior in the previously-unguarded null case). GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 26300.9974, Vulkan SDK 1.4.363.1. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [ ] N/A: no new translator rule. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1255
No description provided.