mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 12:44:30 +08:00
GT-2939 closes #690: handle empty DWARF compilation units.
Pulled-from: FergoFrog <45412+fergofrog@users.noreply.github.com>
This commit is contained in:
+9
@@ -148,6 +148,7 @@ public class DWARFCompilationUnit {
|
|||||||
else {
|
else {
|
||||||
format = DWARF_32;
|
format = DWARF_32;
|
||||||
}
|
}
|
||||||
|
|
||||||
long endOffset = (debugInfoBR.getPointerIndex() + length);
|
long endOffset = (debugInfoBR.getPointerIndex() + length);
|
||||||
short version = debugInfoBR.readNextShort();
|
short version = debugInfoBR.readNextShort();
|
||||||
long abbreviationOffset = DWARFUtil.readOffsetByDWARFformat(debugInfoBR, format);
|
long abbreviationOffset = DWARFUtil.readOffsetByDWARFformat(debugInfoBR, format);
|
||||||
@@ -158,6 +159,14 @@ public class DWARFCompilationUnit {
|
|||||||
throw new DWARFException(
|
throw new DWARFException(
|
||||||
"Only DWARF version 2, 3, or 4 information is currently supported.");
|
"Only DWARF version 2, 3, or 4 information is currently supported.");
|
||||||
}
|
}
|
||||||
|
if (firstDIEOffset > endOffset) {
|
||||||
|
throw new IOException("Invalid length " + (endOffset - startOffset) +
|
||||||
|
" for DWARF Compilation Unit at 0x" + Long.toHexString(startOffset));
|
||||||
|
}
|
||||||
|
else if (firstDIEOffset == endOffset) {
|
||||||
|
// silently skip this empty compunit
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
debugAbbrBR.setPointerIndex(abbreviationOffset);
|
debugAbbrBR.setPointerIndex(abbreviationOffset);
|
||||||
Map<Integer, DWARFAbbreviation> abbrMap =
|
Map<Integer, DWARFAbbreviation> abbrMap =
|
||||||
|
|||||||
Reference in New Issue
Block a user