Debugger: Fix #13797.

- When reading the areas note, there was no check in place to ensure that a
  matching segment for the address was actually found. This would later lead
  to a crash when attempting to read memory from the corresponding (missing)
  piece of memory in the core.
This commit is contained in:
Rene Gollent 2017-12-02 15:57:30 -05:00
parent dfc46d83b7
commit 737de463dd

View File

@ -525,6 +525,13 @@ CoreFile::_ReadAreasNote(const void* data, uint32 dataSize)
// create and add area // create and add area
ElfSegment* segment = _FindAreaSegment(baseAddress); ElfSegment* segment = _FindAreaSegment(baseAddress);
if (segment == NULL) {
WARNING("No matching segment found for area %" B_PRIu64 " (ID %#"
B_PRIx32 " @ %#" B_PRIx64 ", name: '%s')", i, id, baseAddress,
name);
continue;
}
CoreFileAreaInfo* area = new(std::nothrow) CoreFileAreaInfo(segment, id, CoreFileAreaInfo* area = new(std::nothrow) CoreFileAreaInfo(segment, id,
baseAddress, size, ramSize, lock, protection, copiedName); baseAddress, size, ramSize, lock, protection, copiedName);
if (area == NULL || !fAreaInfos.AddItem(area)) { if (area == NULL || !fAreaInfos.AddItem(area)) {