shader: read null SRT pointers as zero in raw scalar reads #1374

Closed
github-bot wants to merge 2 commits from gh-pr/1374/head into gh-pr/1374/base
Owner

@⁠ReverendOzmund on GitHub · 2026-10-10 15:25 UTC · original
ReverendOzmund:fix/srt-null-scalar-read → main · +54 −0 · 2 files · 2 commits · closed without merging

fixes a host segfault in the shader recompiler

PPSA28038 boots, plays the intro videos, then the emulator segfaults right as the menu narration prompt comes up. tracked it with the linker map to SrtWalker::EvaluateRawRead: when theres no memory reader (pipeline cache path) it memcpys straight from the address, and the game had a null SRT pointer at that point so it read from 0

this makes reads below 64 KiB return 0 instead. nothing can ever be mapped there on linux or windows so it could only ever crash, and a zero descriptor ends up as the null buffer which is how empty vector buffers already get handled. open to a different approach if returning false or wiring up a reader there is preferred, first version returned false but that just made MaterializeResources hit its EXIT_IF instead

testing

  • added TestNullScalarAddressWithoutReaderReadsZero to ScalarProvenanceTests, it segfaults without the fix and passes with it
  • PPSA28038 on bazzite 44 / rtx 3080 ti / nvidia 615.71.09: no more segfault, gets further through shader compilation then stops on a different, unrelated check (scalar resource reads overlap a shader buffer write in descriptors.cpp) which ill report separately

ai

used claude to track down the crash and write the fix + test. i ran the test and the game myself before submitting
Screenshot_20261010_231737

**@⁠ReverendOzmund** on GitHub · 2026-10-10 15:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374) `ReverendOzmund:fix/srt-null-scalar-read` → `main` · +54 −0 · 2 files · 2 commits · closed without merging fixes a host segfault in the shader recompiler PPSA28038 boots, plays the intro videos, then the emulator segfaults right as the menu narration prompt comes up. tracked it with the linker map to `SrtWalker::EvaluateRawRead`: when theres no memory reader (pipeline cache path) it memcpys straight from the address, and the game had a null SRT pointer at that point so it read from 0 this makes reads below 64 KiB return 0 instead. nothing can ever be mapped there on linux or windows so it could only ever crash, and a zero descriptor ends up as the null buffer which is how empty vector buffers already get handled. open to a different approach if returning false or wiring up a reader there is preferred, first version returned false but that just made MaterializeResources hit its EXIT_IF instead ## testing - added `TestNullScalarAddressWithoutReaderReadsZero` to ScalarProvenanceTests, it segfaults without the fix and passes with it - PPSA28038 on bazzite 44 / rtx 3080 ti / nvidia 615.71.09: no more segfault, gets further through shader compilation then stops on a different, unrelated check (`scalar resource reads overlap a shader buffer write` in descriptors.cpp) which ill report separately ## ai used claude to track down the crash and write the fix + test. i ran the test and the game myself before submitting <img width="1287" height="755" alt="Screenshot_20261010_231737" src="https://github.com/user-attachments/assets/143cefc8-3487-4d54-95f1-837a51af4f68" />
SrtWalker::EvaluateRawRead dereferences the computed address directly when
no memory reader is supplied (the pipeline cache path). A title can issue
scalar loads through an SRT pointer it has not populated yet, so the walker
read from address 0 and the emulator crashed with a host segfault while
compiling the shader (seen on PPSA28038 shortly after boot).

Read addresses below 64 KiB as zero instead. Nothing can be mapped there on
Linux (mmap_min_addr) or Windows, so such a read could only ever fault, and a
zero descriptor resolves to the null resource, matching how empty vector
buffers are already evaluated.

Adds a ScalarProvenanceTests regression case that segfaults without the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:55 +00:00
github-bot closed this pull request 2026-11-26 09:54:55 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 15:28 UTC · original · edited 2026-10-10 15:43 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 950ffbfc-018f-4b77-ad53-69049ba3524b

📥 Commits

Reviewing files that changed from the base of the PR and between 05dc968a88 and fd4ce64dee.


📒 Files selected for processing (2)
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
  • tests/ScalarProvenanceTests.cpp

🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/ScalarProvenanceTests.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.



📝 Walkthrough

Walkthrough

When no reader callback is available, ordinary and raw reads below 0x10000 return zero. Ordinary reads do not record a guest memory range. Tests cover a scalar read at address zero and a two-word capture read at address 0x20.


Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to fd4ce

The null-pointer read fix appears mergeable after normal checks; no outstanding issue is identified in the supplied evidence.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: raw scalar reads now treat null SRT pointers as zero.
Description check Passed The description explains the host segfault, the affected code path, the null-pointer handling, the added tests, and the reported validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 15:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#issuecomment-6099100217) · edited 2026-10-10 15:43 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1374?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `950ffbfc-018f-4b77-ad53-69049ba3524b` <hr> </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 05dc968a88ef502b1d768854df882db62d112541 and fd4ce64dee9bb119462b05714bf7949f7ac79079. <hr> </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (2)</strong></summary> <dl> <dd> * `src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp` * `tests/ScalarProvenanceTests.cpp` <hr> </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes (2)</strong></summary> <dl> <dd> * tests/ScalarProvenanceTests.cpp * src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp <hr> </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. <hr> </dd> </dl> </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> ## Walkthrough When no reader callback is available, ordinary and raw reads below `0x10000` return zero. Ordinary reads do not record a guest memory range. Tests cover a scalar read at address zero and a two-word capture read at address `0x20`. <hr> </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"fd4ce64dee9bb119462b05714bf7949f7ac79079" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `fd4ce` <!-- final_review_risk_coverage:{"sourceCommitId":"fd4ce64dee9bb119462b05714bf7949f7ac79079","coveredCommitId":"fd4ce64dee9bb119462b05714bf7949f7ac79079","kind":"reviewed"} --> The null-pointer read fix appears mergeable after normal checks; no outstanding issue is identified in the supplied evidence. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v1.svg" width="14" height="17" align="middle" alt="Passed" title="Passed"></picture></sup> 4 | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v1.svg" width="14" height="17" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly summarizes the main change: raw scalar reads now treat null SRT pointers as zero. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the host segfault, the affected code path, the null-pointer handling, the added tests, and the reported validation results. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <hr> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1374)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) <hr> </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -564,0 +582,4 @@
if (address < NullPageLimit) {
result = 0u;
return true;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 15:28 UTC · original · edited 2026-10-10 15:44 UTC

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find ObservedRuntime call sites and inspect whether they pass the result to SrtWalker.
rg -n -C 6 '\bObservedRuntime\s*\(' src tests --glob '*.{cpp,h}'

Repository: KytyPS5/KytyPS5

Length of output: 5429


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- SrtWalker definitions ---'
nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp | sed -n '1,75p'
nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.h | sed -n '1,95p'

printf '%s\n' '--- EvaluateRawRead and nearby read dispatch ---'
rg -n -C 12 -F -- 'EvaluateRawRead' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
rg -n -C 10 -F -- 'read_memory' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp src/graphics/shader/recompiler/ir/passes/SrtWalker.h

printf '%s\n' '--- ResourceMaterialization caller context ---'
nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '1040,1110p'
rg -n -C 8 -F -- 'RefreshFlatBuffer' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp src/graphics/shader/recompiler/ir/passes

Repository: KytyPS5/KytyPS5

Length of output: 28572


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 -F -- 'MaterializeResources(' src tests --glob '*.{cpp,h}'
printf '%s\n' '--- SrtRuntime construction and ordinary reader assignments near callers ---'
rg -n -C 5 -F -- 'SrtRuntime' src/graphics tests --glob '*.{cpp,h}' | head -240

Repository: KytyPS5/KytyPS5

Length of output: 42135


🏁 Script executed:

#!/bin/bash
set -euo pipefail
nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '210,270p'
nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '380,440p'
rg -n -C 6 -F -- 'SrtRuntime' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 8381


Cover the capture wrapper’s direct-read fallback.

The pipeline-cache runtime sets read_specialization_memory but leaves read_memory unset. When capture is enabled, MaterializeResources passes capture.ObservedRuntime() to SrtWalker. ReadOrdinary then directly copies from the SRT address, so the null-page guard in EvaluateRawRead is bypassed. A null or near-null scalar SRT address can fault the host.

Apply the same null-page behavior in ReadOrdinary before memcpy.

🐛 Suggested fix
 namespace Libs::Graphics::ShaderRecompiler::IR {
 
+namespace {
+// Lowest address any host or guest mapping can occupy.
+constexpr uint64_t NullPageLimit = 0x10000ull;
+}
+
 SrtRuntime SrtReadCapture::ObservedRuntime() {
@@
-	} else {
+	} else if (address < NullPageLimit) {
+		std::fill(values.begin(), values.end(), 0u);
+	} else {
 		std::memcpy(values.data(), reinterpret_cast<const void*>(address), values.size_bytes());
 	}
@@
 namespace {
 
 constexpr uint64_t AddressMask = 0x0000ffffffffffffull;
-// Lowest address any host or guest mapping can occupy (matches the default Linux mmap_min_addr
-// and the Windows null-pointer reservation), so direct reads below it always fault.
-constexpr uint64_t NullPageLimit = 0x10000ull;
 
 bool AddSignedAddress(uint64_t base, int64_t offset, uint64_t& result) {

✅ Addressed in commit fd4ce64

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 15:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#discussion_r4238148933) · edited 2026-10-10 15:44 UTC **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail # Find ObservedRuntime call sites and inspect whether they pass the result to SrtWalker. rg -n -C 6 '\bObservedRuntime\s*\(' src tests --glob '*.{cpp,h}' ``` Repository: KytyPS5/KytyPS5 Length of output: 5429 --- 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail printf '%s\n' '--- SrtWalker definitions ---' nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp | sed -n '1,75p' nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.h | sed -n '1,95p' printf '%s\n' '--- EvaluateRawRead and nearby read dispatch ---' rg -n -C 12 -F -- 'EvaluateRawRead' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp rg -n -C 10 -F -- 'read_memory' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp src/graphics/shader/recompiler/ir/passes/SrtWalker.h printf '%s\n' '--- ResourceMaterialization caller context ---' nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '1040,1110p' rg -n -C 8 -F -- 'RefreshFlatBuffer' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp src/graphics/shader/recompiler/ir/passes ``` Repository: KytyPS5/KytyPS5 Length of output: 28572 --- 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail rg -n -C 8 -F -- 'MaterializeResources(' src tests --glob '*.{cpp,h}' printf '%s\n' '--- SrtRuntime construction and ordinary reader assignments near callers ---' rg -n -C 5 -F -- 'SrtRuntime' src/graphics tests --glob '*.{cpp,h}' | head -240 ``` Repository: KytyPS5/KytyPS5 Length of output: 42135 --- 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '210,270p' nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '380,440p' rg -n -C 6 -F -- 'SrtRuntime' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 8381 --- </details> **Cover the capture wrapper’s direct-read fallback.** The pipeline-cache runtime sets `read_specialization_memory` but leaves `read_memory` unset. When capture is enabled, `MaterializeResources` passes `capture.ObservedRuntime()` to `SrtWalker`. `ReadOrdinary` then directly copies from the SRT address, so the null-page guard in `EvaluateRawRead` is bypassed. A null or near-null scalar SRT address can fault the host. Apply the same null-page behavior in `ReadOrdinary` before `memcpy`. <details> <summary>🐛 Suggested fix</summary> ```diff namespace Libs::Graphics::ShaderRecompiler::IR { +namespace { +// Lowest address any host or guest mapping can occupy. +constexpr uint64_t NullPageLimit = 0x10000ull; +} + SrtRuntime SrtReadCapture::ObservedRuntime() { @@ - } else { + } else if (address < NullPageLimit) { + std::fill(values.begin(), values.end(), 0u); + } else { std::memcpy(values.data(), reinterpret_cast<const void*>(address), values.size_bytes()); } @@ namespace { constexpr uint64_t AddressMask = 0x0000ffffffffffffull; -// Lowest address any host or guest mapping can occupy (matches the default Linux mmap_min_addr -// and the Windows null-pointer reservation), so direct reads below it always fault. -constexpr uint64_t NullPageLimit = 0x10000ull; bool AddSignedAddress(uint64_t base, int64_t offset, uint64_t& result) { ``` </details> <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:272680e96ee53a1cd8ee7a3e --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit fd4ce64
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 15:28 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c06743b-cbd3-4e11-8bb4-1ed8f0da7672
📥 Commits

Reviewing files that changed from the base of the PR and between 307fdcf7ad and 05dc968a88.

📒 Files selected for processing (2)
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
  • tests/ScalarProvenanceTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 15:28 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#pullrequestreview-5479593814) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `8c06743b-cbd3-4e11-8bb4-1ed8f0da7672` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 307fdcf7ad5d9d15b5966288fcc598ac9dbca188 and 05dc968a88ef502b1d768854df882db62d112541. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp` * `tests/ScalarProvenanceTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=799997f8-5033-4e9a-80cf-fbfe5b7483c8 attempt=4cb89e22-feed-4f53-bb2f-652df541816e batch=1/1 -->
@ -564,0 +582,4 @@
if (address < NullPageLimit) {
result = 0u;
return true;
}
Author
Owner

@⁠ReverendOzmund on GitHub · 2026-10-10 15:42 UTC · original

good catch, ReadOrdinary had the same raw memcpy. moved NullPageLimit up so both use it and ReadOrdinary now zero fills without recording a range since nothing was actually read. added TestNullScalarAddressCaptureReadsZero, segfaults without the guard and passes with it

**@⁠ReverendOzmund** on GitHub · 2026-10-10 15:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#discussion_r4238190208) good catch, ReadOrdinary had the same raw memcpy. moved NullPageLimit up so both use it and ReadOrdinary now zero fills without recording a range since nothing was actually read. added TestNullScalarAddressCaptureReadsZero, segfaults without the guard and passes with it
@ -564,0 +582,4 @@
if (address < NullPageLimit) {
result = 0u;
return true;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 15:44 UTC · original

@ReverendOzmund, thanks for the fix. ReadOrdinary now uses the shared NullPageLimit guard and returns zeros without recording a guest memory range. The regression test covers the capture-wrapper path that bypassed the original guard.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 15:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#discussion_r4238196867) `@ReverendOzmund`, thanks for the fix. `ReadOrdinary` now uses the shared `NullPageLimit` guard and returns zeros without recording a guest memory range. The regression test covers the capture-wrapper path that bypassed the original guard. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=A%20raw%20%60memcpy%60%20bypassed%20the%20null-page%20guard%20and%20could%20crash%20the%20host.%20%40coderabbitai%20caught%20it%3B%20the%20fix%20zero-fills%20near-null%20reads%20and%20adds%20a%20regression%20test.%20Try%20it%20for%20sharper%20code%20reviews!%20%F0%9F%9B%A1%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1374%23discussion_r4238148933)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-10 19:53 UTC · original

Duplicate

**@⁠Nmzik** on GitHub · 2026-10-10 19:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1374#issuecomment-6101559046) Duplicate

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.