[CPU] Fix heap corruption by XEXP header patch not resizing headers correctly

This should hopefully fix GTA IV's TU (for media ID 6AC07221 at least)
This commit is contained in:
emoose 2020-01-05 19:18:18 +00:00 committed by illusion98
parent 3e74b85c20
commit f58fba9219
1 changed files with 1 additions and 9 deletions

View File

@ -248,15 +248,7 @@ int XexModule::ApplyPatch(XexModule* module) {
// Patch base XEX header // Patch base XEX header
uint32_t original_image_size = module->image_size(); uint32_t original_image_size = module->image_size();
uint32_t header_target_size = patch_header->delta_headers_target_offset + uint32_t header_target_size = patch_header->size_of_target_headers;
patch_header->delta_headers_source_size;
if (!header_target_size) {
header_target_size =
patch_header->size_of_target_headers; // unsure which is more correct..
}
size_t mem_size = module->xex_header_mem_.size();
// Increase xex header buffer length if needed // Increase xex header buffer length if needed
if (header_target_size > module->xex_header_mem_.size()) { if (header_target_size > module->xex_header_mem_.size()) {