Correct loader URI reporting

- Check address is in the range of the mapped file.
  - Correct calculation of offset within the file.

Change-Id: I848a3ead4422698c2ef1c140bc8ae5e000a717f7


[ROCm/ROCR-Runtime commit: 5f614c31f5]
Cette révision appartient à :
Konstantin Zhuravlyov
2020-06-02 12:01:59 -04:00
révisé par Konstantin Zhuravlyov
Parent 981acecc79
révision 6a31d12208
+4 -2
Voir le fichier
@@ -141,7 +141,7 @@ std::string CodeObjectReaderWrapper::GetUriFromMemory(
}
uint64_t MyAddress = reinterpret_cast<uint64_t>(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;
}