fix(libSceGnmDriverForNeoMode): return CommandFailed for null command buffers #16360
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16360"
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 MarcZX10 on 2026-11-06T11:52:34Z.
What
Four command writers in
libSceGnmDriverForNeoMode/Export.cppwrote through their command buffer pointer without a null check, so a null buffer crashed the host. The null-checking siblings in the same file (for examplesceGnmSetPsShader350) returnCommandFailed(-1).fix(libSceGnmDriverForNeoMode): return CommandFailed for a null default-state command buffer:WriteHardwareStateandWriteContextState, which back thesceGnmDrawInitDefaultHardwareState*andsceGnmDrawInitToDefaultContextState*exports, return -1 for a null buffer. The existing size-mismatch result (0) is unchanged.CommandFailedmoves above the templates so they can use it.fix(libSceGnmDriverForNeoMode): return CommandFailed for a null embedded-shader command buffer:sceGnmSetEmbeddedPsShaderandsceGnmSetEmbeddedVsShaderreturn -1 for a null buffer before reading the shader id.testcommit after each fix (GuestGnmNeoDefaultState.cpp,GuestGnmNeoEmbedded.cpp).docs(debt): note the unmeasured return for a null GNM command buffer: the console's result for a null buffer is not measured. To stay under the length limit of a debt entry, one clause of the embedded-shader entry ("since nothing here reads them") was dropped.Tested
Linux, throwaway archive build of this head:
BUILD-EXIT 0, ctestguest_gnm_neo_default_stateandguest_gnm_neo_embedded(targetsguest_gnm_neo_default_state_testsandguest_gnm_neo_embedded_tests) passed, 2 of 2.python3 tools/check_conventions.pyagainst the merge base andgit diff --checkare clean. The new cases were not run against the unfixed code; that they fail without the fixes is reasoned from the code (a null dereference). Not run on Windows or macOS. Open PRs #16238 and #15605 edit stubs in the sameExport.cppbut not these functions; a rebase conflict is possible.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)