diff --git a/core/libs/tests/GuestMemory.cpp b/core/libs/tests/GuestMemory.cpp index 21c1a7d6af..73790f6274 100644 --- a/core/libs/tests/GuestMemory.cpp +++ b/core/libs/tests/GuestMemory.cpp @@ -151,6 +151,11 @@ static void CheckPageTableStats() { Require(sceKernelGetPageTableStats(&cpuTotal, nullptr, &gpuTotal, &gpuAvailable) == SCE_KERNEL_ERROR_EFAULT); Require(sceKernelGetPageTableStats(&cpuTotal, &cpuAvailable, nullptr, &gpuAvailable) == SCE_KERNEL_ERROR_EFAULT); Require(sceKernelGetPageTableStats(&cpuTotal, &cpuAvailable, &gpuTotal, nullptr) == SCE_KERNEL_ERROR_EFAULT); + auto* bad = reinterpret_cast(0x10); + Require(sceKernelGetPageTableStats(bad, &cpuAvailable, &gpuTotal, &gpuAvailable) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&cpuTotal, bad, &gpuTotal, &gpuAvailable) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&cpuTotal, &cpuAvailable, bad, &gpuAvailable) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&cpuTotal, &cpuAvailable, &gpuTotal, bad) == SCE_KERNEL_ERROR_EFAULT); } static void CheckInternalMemoryAvailableSize() { diff --git a/core/libs/tests/GuestPageTableStats.cpp b/core/libs/tests/GuestPageTableStats.cpp index 18b33b9f39..06819894e0 100644 --- a/core/libs/tests/GuestPageTableStats.cpp +++ b/core/libs/tests/GuestPageTableStats.cpp @@ -55,6 +55,11 @@ static void CheckRejectedArguments() { Require(sceKernelGetPageTableStats(&value, nullptr, &value, &value) == SCE_KERNEL_ERROR_EFAULT); Require(sceKernelGetPageTableStats(&value, &value, nullptr, &value) == SCE_KERNEL_ERROR_EFAULT); Require(sceKernelGetPageTableStats(&value, &value, &value, nullptr) == SCE_KERNEL_ERROR_EFAULT); + auto* bad = reinterpret_cast(0x10); + Require(sceKernelGetPageTableStats(bad, &value, &value, &value) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&value, bad, &value, &value) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&value, &value, bad, &value) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetPageTableStats(&value, &value, &value, bad) == SCE_KERNEL_ERROR_EFAULT); } static void CheckCpuGranules() { @@ -111,6 +116,10 @@ static void CheckTraceMemoryStats() { second[0] = 1; Require(sceKernelGetTraceMemoryStats(nullptr, second) == 0 && second[0] == 0); Require(sceKernelGetTraceMemoryStats(nullptr, nullptr) == 0); + auto* badTrace = reinterpret_cast(0x10); + Require(sceKernelGetTraceMemoryStats(badTrace, nullptr) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetTraceMemoryStats(nullptr, badTrace) == SCE_KERNEL_ERROR_EFAULT); + Require(sceKernelGetTraceMemoryStats(badTrace, badTrace) == SCE_KERNEL_ERROR_EFAULT); } int main() {