Correct loader URI reporting

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

Change-Id: I848a3ead4422698c2ef1c140bc8ae5e000a717f7
Dieser Commit ist enthalten in:
Konstantin Zhuravlyov verfasst und Konstantin Zhuravlyov committed 2020-06-03 13:03:07 -04:00
1 Ursprung da6d892058
Commit 5f614c31f5
1 Datei geändert
+4 -2
@@ -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;
}