libdebugger: Fix a regression with ELF loading in some cases.

ElfFile:
- The refactoring in commit 2c50fbb8e1
  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.
This commit is contained in:
Rene Gollent
2016-12-07 22:17:34 -05:00
parent 245304f141
commit 7cfc043e00
+1 -1
View File
@@ -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;
}