[CPU] Fix some compressed XEXs decompressing past the image size
This commit is contained in:
@@ -831,7 +831,6 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
|
|||||||
uint8_t* compress_buffer = NULL;
|
uint8_t* compress_buffer = NULL;
|
||||||
const uint8_t* p = NULL;
|
const uint8_t* p = NULL;
|
||||||
uint8_t* d = NULL;
|
uint8_t* d = NULL;
|
||||||
uint32_t uncompressed_size = 0;
|
|
||||||
sha1::SHA1 s;
|
sha1::SHA1 s;
|
||||||
|
|
||||||
// Decrypt (if needed).
|
// Decrypt (if needed).
|
||||||
@@ -895,8 +894,6 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
|
|||||||
memcpy(d, p, chunk_size);
|
memcpy(d, p, chunk_size);
|
||||||
p += chunk_size;
|
p += chunk_size;
|
||||||
d += chunk_size;
|
d += chunk_size;
|
||||||
|
|
||||||
uncompressed_size += 0x8000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = pnext;
|
p = pnext;
|
||||||
@@ -904,6 +901,8 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!result_code) {
|
if (!result_code) {
|
||||||
|
uint32_t uncompressed_size = image_size();
|
||||||
|
|
||||||
// Allocate in-place the XEX memory.
|
// Allocate in-place the XEX memory.
|
||||||
bool alloc_result =
|
bool alloc_result =
|
||||||
memory()
|
memory()
|
||||||
|
|||||||
Reference in New Issue
Block a user