fix: define decoded AGC state and bound size arithmetic #10249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10249"
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?
Imported from boykopovar/AnyPS5. Originally posted by zoelmoj on 2026-10-23T15:37:53Z.
What
Fixes undefined-behaviour and correctness defects in the AGC driver, guest libc, NGS2, IME, VideoOut, the shader recompiler and the relinker:
Graphics::State,ShaderStages,ColorTargetandDepthTargethad members without initializers (scissor,cullMode,frontFace,blend,blendConstants,viewport,renderExtent,topology,hasColorTarget,negativeOneToOne,path,registerValue, the wave sizes,address,extent,format,bytes,componentMapping,clearDepth,clearStencil).Driver::sameDecodecomparesblendConstantsand the sample masks, so a default-constructedStateread indeterminate memory.Ngs2CustomModuleOptionis a 4-bytesizefield;OptionWordread 4 bytes at offset 4, past the declared object. It now validates the guest-declared option size and returns the option error code when the option is truncated.RecorderindexedsyncWaitedMs[source](5 entries) and, insideCountThreadSync,counts[source]andwaitedMs[source], before any range check.ThreadOwnedlost the object whenpush_backthrew while registering it.sceLibcMspaceCreatereturned success when the map insertion failed.MultisampledDepthBytes,StorageTexture::sliceWindows, the vertex input table read,VideoOutDriver::processFlipand the Mach-O init stub displacement.Sequence::SubmitComputecopied the compute shader register and specials pointers withsizeofapplied to pointer variables, which reads as a mistake. The copy now goes throughstd::uintptr_t, so the width is the pointer size by construction.fprintfreceivedRegisters::Referenceproxies (Pm4 context trace) and uncast register values (draw capture dump).StencilReferenceUnusedcomparedVkCompareOpagainstVK_COMPARE_OP_NEVER, which is 0 and therefore unreachable.FilterTextcomputedtype - 0x100onstd::uint32_tbefore checkingtype >= 0x100.~Replaycalled its virtualCancel/Waitunqualified, the tessellation attribute switch leftInstanceInput/InstanceOutputimplicit, andAdjustedDeltacarried an unusedcutStartparameter.Tested
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ...,cmake --build build --parallel 12andcmake --build build --target libs --parallel 12all succeed on top of currentmain; the patched.prxset is produced.ctest -R '^(mspace|agc_driver_pm4|agc_driver_draw_program_trace|guest_ime_filter_text|ngs2_core_render)$': 5/5 pass.clang-tidy -p build -checks='-*,bugprone-sizeof-expression' core/libs/prx/libSceJobManager/Export.cpp: reportedExport.cpp:349before the change, nothing after it.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1and the validation layer still need a run on hardware.python3 tools/check_conventions.py --base origin/mainpasses.python3 tools/pr_overlap.py --branch fix/agc-state-init-and-boundsreports file-level overlap with open PRs that implement unrelated features and fixes. The two hunks that duplicated open work were dropped: the DepthSurface tile-mode format is #7504, and theSequence::Advanceerase line is replaced by #10231/#10244.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Pull request closed