mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-08-25 03:56:41 +00:00
GP-0 fix DWARF NPE when .debug_info is 0-padded, DW_FORM_implicit
Fix NPE when null unitHeader (indicating trailing 0-padding was encountered), and fixed DW_FORM_implicit / DW_FORM_indirect typo in DWARFAttributeDef read().
This commit is contained in:
parent
b8f004c792
commit
10c4a59550
|
@ -316,10 +316,11 @@ public class DWARFProgram implements Closeable {
|
|||
|
||||
DWARFUnitHeader unitHeader =
|
||||
DWARFUnitHeader.read(this, debugInfoBR, debugAbbrBR, compUnits.size(), monitor);
|
||||
if (unitHeader != null) {
|
||||
debugInfoBR.setPointerIndex(unitHeader.getEndOffset());
|
||||
if (unitHeader == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
debugInfoBR.setPointerIndex(unitHeader.getEndOffset());
|
||||
if (unitHeader instanceof DWARFCompilationUnit cu) {
|
||||
compUnits.add(cu);
|
||||
importSummary.dwarfVers.add((int) cu.getDWARFVersion());
|
||||
|
|
|
@ -69,8 +69,9 @@ public class DWARFAttributeDef<E extends Enum<E>> {
|
|||
E e = mapper.apply(attributeId);
|
||||
|
||||
// NOTE: implicit value is a space saving hack built into DWARF. It adds an extra
|
||||
// field in the attributespec that needs to be read.
|
||||
long implicitValue = form == DWARFForm.DW_FORM_indirect // read leb128 if present
|
||||
// field in the attributespec that needs to be read now in the .debug_abbr. This is
|
||||
// different than DW_FORM_indirect, which is read from the DIE in .debug_info
|
||||
long implicitValue = form == DWARFForm.DW_FORM_implicit_const // read leb128 if present
|
||||
? reader.readNext(LEB128::signed)
|
||||
: 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue