Merge pull request #1253 from emoose/compressed-xex-fix

[CPU] Fix some compressed XEXs trying to decompress past the actual image size, causing errors
This commit is contained in:
Rick Gibbed 2018-11-09 20:27:01 -06:00 committed by GitHub
commit 128fb32698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -831,7 +831,6 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
uint8_t* compress_buffer = NULL;
const uint8_t* p = NULL;
uint8_t* d = NULL;
uint32_t uncompressed_size = 0;
sha1::SHA1 s;
// Decrypt (if needed).
@ -895,8 +894,6 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
memcpy(d, p, chunk_size);
p += chunk_size;
d += chunk_size;
uncompressed_size += 0x8000;
}
p = pnext;
@ -904,6 +901,8 @@ int XexModule::ReadImageCompressed(const void* xex_addr, size_t xex_length) {
}
if (!result_code) {
uint32_t uncompressed_size = image_size();
// Allocate in-place the XEX memory.
bool alloc_result =
memory()