mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-08 13:43:27 +02:00
Correct two minor bugs causing reported crashes
This commit is contained in:
@@ -1096,8 +1096,8 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
|
||||
// In this case it's definitely not compressed. Added assert below.
|
||||
}
|
||||
|
||||
// Don't accept ELFs over 24MB.
|
||||
if (decryptedSize > 24 * 1024 * 1024) {
|
||||
// Don't accept ELFs over 24MB - nor ones with negative size, of course.
|
||||
if (decryptedSize < 0 || decryptedSize > 24 * 1024 * 1024) {
|
||||
*error_string = StringFromFormat("ELF/PRX corrupt, unreasonable decrypted size: %d", (u32)decryptedSize);
|
||||
// TODO: Might be the wrong error code.
|
||||
error = SCE_KERNEL_ERROR_FILEERR;
|
||||
@@ -1110,7 +1110,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
|
||||
|
||||
// Can't decompress in place so we need a temporary buffer.
|
||||
u8 *temp = (u8 *)malloc(decryptedSize);
|
||||
_assert_msg_(temp != nullptr, "Failed to allocate gzip decompression buffer");
|
||||
_assert_msg_(temp != nullptr, "Failed to allocate gzip decompression buffer (decryptedSize: %d)", decryptedSize);
|
||||
memcpy(temp, ptr, decryptedSize);
|
||||
int outBytes = gzipDecompress((u8 *)ptr, maxElfSize, temp);
|
||||
if (outBytes < 0) {
|
||||
|
||||
Reference in New Issue
Block a user