Core: Add range checks to some helpers and similar.

This commit is contained in:
Unknown W. Brackets
2023-01-08 14:10:16 -08:00
parent e9ce0d0b5e
commit dea9cac16c
10 changed files with 32 additions and 27 deletions

View File

@@ -401,8 +401,8 @@ int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
}
if (!Memory::IsValidAddress(outdataPtr) || outlen < 0x800) {
WARN_LOG_REPORT(FILESYS, "sceIoIoctl: Invalid out pointer while reading ISO9660 volume descriptor");
if (!Memory::IsValidRange(outdataPtr, 0x800) || outlen < 0x800) {
WARN_LOG_REPORT(FILESYS, "sceIoIoctl: Invalid out pointer %08x while reading ISO9660 volume descriptor", outdataPtr);
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
}
@@ -424,7 +424,7 @@ int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd
} else {
int block = (u16)desc.firstLETableSector;
u32 size = Memory::ValidSize(outdataPtr, (u32)desc.pathTableLength);
u8 *out = Memory::GetPointerWrite(outdataPtr);
u8 *out = Memory::GetPointerWriteRange(outdataPtr, size);
int blocks = size / blockDevice->GetBlockSize();
blockDevice->ReadBlocks(block, blocks, out);