From 7cfc043e00a07b46a7bccc56b9475b1be54b8dae Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 7 Dec 2016 22:12:10 -0500 Subject: [PATCH] libdebugger: Fix a regression with ELF loading in some cases. ElfFile: - The refactoring in commit 2c50fbb8e16102886d0cd28135dae0b58b9d33f4 inadvertently introduced a failure case if a section in the ELF file is skipped, since it was explicitly passing in the insertion index to BObjectList::AddItem(). Since in the skipped case, this would be out of bounds for the list's current size, this would cause the whole operation to fail with an out of memory error, and consequently halt all further loading of debug information for that particular file. This manifested itself with libroot on at least gcc5, where no symbols could be seen. --- src/kits/debugger/elf/ElfFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/debugger/elf/ElfFile.cpp b/src/kits/debugger/elf/ElfFile.cpp index 10059cebea..9cbe381214 100644 --- a/src/kits/debugger/elf/ElfFile.cpp +++ b/src/kits/debugger/elf/ElfFile.cpp @@ -476,7 +476,7 @@ ElfFile::_LoadFile(const char* fileName) Get(sectionHeader->sh_flags), Get(sectionHeader->sh_link)); if (section == NULL) return B_NO_MEMORY; - if (!fSections.AddItem(section, i)) { + if (!fSections.AddItem(section)) { delete section; return B_NO_MEMORY; }