Skip to content

Commit

Permalink
Fix address adjustment in bundle unmap for macos universal binaries (d…
Browse files Browse the repository at this point in the history
…otnet#69689)

Co-authored-by: vsadov <8218165+VSadov@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and VSadov authored Jun 9, 2022
1 parent a79d7c4 commit efae0ef
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 @@ -124,14 +124,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 efae0ef

Please sign in to comment.