From 737de463ddfff27b6d4003457c3d084de1d06997 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 2 Dec 2017 15:57:30 -0500 Subject: [PATCH] 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. --- src/kits/debugger/elf/CoreFile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/kits/debugger/elf/CoreFile.cpp b/src/kits/debugger/elf/CoreFile.cpp index c4eb3ac5c8..ae06ed2076 100644 --- a/src/kits/debugger/elf/CoreFile.cpp +++ b/src/kits/debugger/elf/CoreFile.cpp @@ -525,6 +525,13 @@ CoreFile::_ReadAreasNote(const void* data, uint32 dataSize) // create and add area 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, baseAddress, size, ramSize, lock, protection, copiedName); if (area == NULL || !fAreaInfos.AddItem(area)) {