Skip to content
Permalink
Browse files

A DWARF related section marked SHT_NOBITS (elf section type)

is an error in the elf object.  Now detected.
dwarf_elf_access.c
  • Loading branch information...
David Anderson
David Anderson committed Dec 30, 2015
1 parent 47fdf4a commit 11750a2838e52953013e3114ef27b3c7b1780697
Showing with 17 additions and 1 deletion.
  1. +4 −0 libdwarf/ChangeLog
  2. +13 −1 libdwarf/dwarf_elf_access.c
@@ -1,3 +1,7 @@
2015-12-30 David Anderson
* dwarf_elf_access.c(dwarf_elf_object_access_load_section):
now test for a NULL data pointer from libelf. Problem caused
by DWARF related section being marked SHT_NOBITS.
2015-12-29 David Anderson
* dwarf_loc2.c: ll_dbg was not set, two places.
dwarf_loc_head_c_dealloc() was not iterating
@@ -1201,7 +1201,9 @@ dwarf_elf_object_relocate_a_section(void* obj_in,
return res;
}

/* dwarf_elf_object_access_load_section */
/* dwarf_elf_object_access_load_section()
We are only asked to load sections that
libdwarf really needs. */
static int
dwarf_elf_object_access_load_section(void* obj_in,
Dwarf_Half section_index,
@@ -1235,6 +1237,16 @@ dwarf_elf_object_access_load_section(void* obj_in,
*error = DW_DLE_MDE;
return DW_DLV_ERROR;
}
if (!data->d_buf) {
/* If NULL it means 'the section has no data'
according to libelf documentation.
No DWARF-related section should ever have
'no data'. Happens if a section type is
SHT_NOBITS and no section libdwarf
wants to look at should be SHT_NOBITS. */
*error = DW_DLE_MDE;
return DW_DLV_ERROR;
}
*section_data = data->d_buf;
}
return DW_DLV_OK;

0 comments on commit 11750a2

Please sign in to comment.
You can’t perform that action at this time.