diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_hsa_loader.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_hsa_loader.cpp index 9663dfa540..263a4deaa3 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_hsa_loader.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_hsa_loader.cpp @@ -141,7 +141,7 @@ std::string CodeObjectReaderWrapper::GetUriFromMemory( } uint64_t MyAddress = reinterpret_cast(Mem); - if (!(MyAddress >= LowAddress && MyAddress <= HighAddress)) { + if (!(MyAddress >= LowAddress && (MyAddress + Size) <= HighAddress)) { continue; } @@ -157,9 +157,11 @@ std::string CodeObjectReaderWrapper::GetUriFromMemory( return GetUriFromMemoryBasic(Mem, Size); } + uint64_t UriOffset = Offset + MyAddress - LowAddress; + std::ostringstream UriStream; UriStream << EncodePathname(Pathname.c_str()); - UriStream << "#offset=" << Offset; + UriStream << "#offset=" << UriOffset; if (Size) { UriStream << "&size=" << Size; }