Skip to content

Commit

Permalink
Fix address adjustment in bundle unmap for macos universal binaries (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
VSadov authored May 31, 2022
1 parent b6c30d1 commit 2631413
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/native/corehost/bundle/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ char* info_t::config_t::map(const pal::string_t& path, const location_t* &locati

trace::info(_X("Mapped bundle for [%s]"), path.c_str());

return addr + location->offset + app->m_offset_in_file;
// Adjust to the beginning of the bundle
return addr + (location->offset + app->m_offset_in_file);
}

void info_t::config_t::unmap(const char* addr, const location_t* location)
{
// Adjust to the beginning of the bundle.
const bundle::info_t* app = bundle::info_t::the_app;
addr -= location->offset - app->m_offset_in_file;
// Reverse the adjustment to the beginning of the bundle
addr = addr - (location->offset + app->m_offset_in_file);

bundle::info_t::the_app->unmap_bundle(addr);
}
Expand Down

0 comments on commit 2631413

Please sign in to comment.