mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 21:16:24 +02:00
Some constification in ElfReader, sanity checks in sceKernelMutex. Might help #9718 a little bit, though probably not the Elf issue (and if the workarea pointer is bad, it's not likely the game will limp along for much longer)
This commit is contained in:
1 parent
da8ac556e4
commit
e981139e71
3 files changed
+60
-33
No files matched your search
@@ -932,6 +932,11 @@ int sceKernelTryLockLwMutex(u32 workareaPtr, int count)
|
||||
{
|
||||
DEBUG_LOG(SCEKERNEL, "sceKernelTryLockLwMutex(%08x, %i)", workareaPtr, count);
|
||||
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
u32 error = 0;
|
||||
@@ -948,6 +953,11 @@ int sceKernelTryLockLwMutex_600(u32 workareaPtr, int count)
|
||||
{
|
||||
DEBUG_LOG(SCEKERNEL, "sceKernelTryLockLwMutex_600(%08x, %i)", workareaPtr, count);
|
||||
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
u32 error = 0;
|
||||
@@ -963,6 +973,11 @@ int sceKernelLockLwMutex(u32 workareaPtr, int count, u32 timeoutPtr)
|
||||
{
|
||||
VERBOSE_LOG(SCEKERNEL, "sceKernelLockLwMutex(%08x, %i, %08x)", workareaPtr, count, timeoutPtr);
|
||||
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
u32 error = 0;
|
||||
@@ -994,6 +1009,11 @@ int sceKernelLockLwMutexCB(u32 workareaPtr, int count, u32 timeoutPtr)
|
||||
{
|
||||
VERBOSE_LOG(SCEKERNEL, "sceKernelLockLwMutexCB(%08x, %i, %08x)", workareaPtr, count, timeoutPtr);
|
||||
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
u32 error = 0;
|
||||
@@ -1025,6 +1045,11 @@ int sceKernelUnlockLwMutex(u32 workareaPtr, int count)
|
||||
{
|
||||
VERBOSE_LOG(SCEKERNEL, "sceKernelUnlockLwMutex(%08x, %i)", workareaPtr, count);
|
||||
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
if (workarea->uid == -1)
|
||||
@@ -1093,8 +1118,10 @@ int sceKernelReferLwMutexStatusByID(SceUID uid, u32 infoPtr)
|
||||
|
||||
int sceKernelReferLwMutexStatus(u32 workareaPtr, u32 infoPtr)
|
||||
{
|
||||
if (!Memory::IsValidAddress(workareaPtr))
|
||||
return -1;
|
||||
if (!Memory::IsValidAddress(workareaPtr)) {
|
||||
ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex");
|
||||
return SCE_KERNEL_ERROR_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
auto workarea = PSPPointer<NativeLwMutexWorkarea>::Create(workareaPtr);
|
||||
|
||||
|
||||
Reference in new issue
Block a user