fix(libSceVdecSavc): ignore unwritable version pointers in sceSdecGetVersionSw

This commit is contained in:
fogydes committed 2026-11-02 14:57:14 +05:30
1 parent 88e804b0a7
commit 28ad61347c
3 files changed
+8 -2

No files matched your search

+6 -1
View File
@@ -3,6 +3,7 @@
#include <cstddef>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
#include <cerrno>
extern "C" {
@@ -17,7 +18,11 @@ int APS5_VABI sceSdecDestroySw() {
}
void APS5_VABI sceSdecGetVersionSw(std::uint32_t* version) {
if (version != nullptr) *version = 0u;
if (version == nullptr) return;
const std::uint32_t value = 0u;
const auto preserved = errno;
GuestCopyOut_nid_no_patch(version, &value, sizeof(value));
errno = preserved;
}
int APS5_VABI sceSdecQueryMemorySw() {
+1
View File
@@ -38,6 +38,7 @@ void CheckVersion(GetVersion getVersion, std::uint32_t expected, const char* nam
int main() {
CheckVersion(sceSdecGetVersionSw, 0u, "sceSdecGetVersionSw");
sceSdecGetVersionSw(reinterpret_cast<std::uint32_t*>(0x10));
CheckVersion(sceSdecGetVersionSw2, 0x13590001u, "sceSdecGetVersionSw2");
CheckVersion(sceSdecGetVersionSwHevc, 0x13590001u, "sceSdecGetVersionSwHevc");
std::puts("sdec version tests passed");
+1 -1
View File
@@ -3,4 +3,4 @@
### Unknown function info
- [sceSdecCreateSw, sceSdecDestroySw and sceSdecQueryMemorySw](../../../core/libs/prx/libSceVdecSavc/Export.cpp) (libSceVdecSavc) - names and NIDs are present in the [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceVdecSavc.c), but no credible prototypes were found. The declarations have no parameters solely to resolve known imports; this is not an ABI claim and callers must not call them until signatures are verified
- [sceSdecGetVersionSw](../../../core/libs/prx/libSceVdecSavc/Export.cpp) (libSceVdecSavc) - the prototype and behaviour follow firmware 13.42's libSceVdecSavc.sprx, read from disassembly and run under an emulator, not measured on a console: it takes a `uint32_t*`, writes 0 there unless the pointer is null, and returns nothing
- [sceSdecGetVersionSw](../../../core/libs/prx/libSceVdecSavc/Export.cpp) (libSceVdecSavc) - the prototype and behaviour follow firmware 13.42's libSceVdecSavc.sprx, read from disassembly and run under an emulator, not measured on a console: it takes a `uint32_t*`, writes 0 there unless the pointer is null, and returns nothing; an unwritable version pointer is ignored defensively, as console behavior on unmapped or read-only memory is not measured