Repository navigation
fix(shader): report a truncated memory, image or export instruction as out of range - #2034
Merged
adriadam10 merged 1 commit intoOct 10, 2026
Conversation
…s out of range ReadRawComputeShader decodes a growing prefix of guest memory and reads more when the decoder throws std::out_of_range, which the vector, scalar and instruction-length checks throw for an instruction cut off by the end of the span. The memory (SMEM, DS, MUBUF, MTBUF, FLAT), image and export decoders threw std::runtime_error instead, so a two-word instruction across a window boundary failed the read: vkQuake terminated on "truncated FLAT instruction". These now throw std::out_of_range too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
approved these changes
Oct 9, 2026
MarcZX10
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the complete current diff. Only truncated-span checks in the memory, image/NSA, and export decoders change exception type; the diagnostic strings and invalid-PC checks remain unchanged. The regression crosses the initial 64-word read window, and current Linux, Windows, conventions, and report checks are green. Approved.
This was referenced Oct 9, 2026
Collaborator
|
Checked: build + ctest (libSceAgc, libSceAgcDriver) green locally; |
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…-decode-out-of-range fix(shader): report a truncated memory, image or export instruction as out of range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ReadRawComputeShader(the fallback for compute programs that were never registered) reads a growing prefix of guest memory, 64, 128, 256 words and so on, and decodes it. When the decoder throwsstd::out_of_range, it reads more. The instruction-length check, the scalar decoder and the vector decoders throwstd::out_of_rangefor an instruction cut off by the end of the span.The memory decoders (SMEM, DS, MUBUF, MTBUF, FLAT, through
requireTwoWordsand the generic memory check), the image decoder (MIMG and its NSA payload) and the export decoder threwstd::runtime_errorinstead. So when a two-word instruction of those families lay across a window boundary, the read failed instead of growing. Whether it happened depended on where the program's instructions fell. vkQuake (PPSA99010) terminated withtruncated FLAT instructionin some runs and not others.Those five throw sites now use
std::out_of_range, like the rest of the decoder. The messages are unchanged. Nothing in the tree catchesstd::runtime_erroraround decoding; the one test that matches a truncation message (LdsCondxchg,truncated DS instruction) catchesstd::exception.Test (
agc_driver): a raw program of 63s_nop, a two-words_load_dwordin words 63 and 64, ands_endpgmreads back as 66 words. It fails (truncated SMEM instruction) without the change.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.
CTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.py --base origin/mainpasses.Not tested on Linux or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code