Skip to content

Commit

Permalink
Fix fencepost error in string table guard; get shared pointer once ra…
Browse files Browse the repository at this point in the history
…ther than at each use so that it can't disappear mid-function by accident.
  • Loading branch information
wrwilliams committed Dec 7, 2016
1 parent c06e9c0 commit c5d8942
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions symtabAPI/src/dwarfWalker.C
Expand Up @@ -1628,15 +1628,16 @@ bool DwarfWalker::getLineInformation(Dwarf_Unsigned &variableLineNo,
fileName = "";
}
else if (status == DW_DLV_OK) {
StringTablePtr files = srcFiles();
Dwarf_Unsigned fileNameDeclVal;
DWARF_FAIL_RET(dwarf_formudata(fileDeclAttribute, &fileNameDeclVal, NULL));
dwarf_dealloc( dbg(), fileDeclAttribute, DW_DLA_ATTR );
if (fileNameDeclVal > srcFiles()->size() || fileNameDeclVal <= 0) {
if (fileNameDeclVal >= files->size() || fileNameDeclVal <= 0) {
dwarf_printf("Dwarf error reading line index %d from srcFiles of size %lu\n",
fileNameDeclVal, srcFiles()->size());
fileNameDeclVal, files->size());
return false;
}
fileName = (*srcFiles())[fileNameDeclVal].str;
fileName = ((files->get<0>())[fileNameDeclVal]).str;
}
else {
return true;
Expand Down

0 comments on commit c5d8942

Please sign in to comment.