Skip to content

Commit bef1fc9

Browse files
committed
One place in generic_ehdr_from_64()
needed a check for e_shnum zero. modified: src/lib/libdwarf/dwarf_elf_load_headers.c
1 parent 001957b commit bef1fc9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/libdwarf/dwarf_elf_load_headers.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ generic_ehdr_from_32(dwarf_elf_object_access_internals_t *ep,
233233
ehdr->ge_shnum_extended = TRUE;
234234
} else {
235235
ehdr->ge_shnum_in_shnum = TRUE;
236+
if (!ehdr->ge_shnum) {
237+
return DW_DLV_NO_ENTRY;
238+
}
236239
if (ehdr->ge_shnum < 3) {
237240
*errcode = DW_DLE_TOO_FEW_SECTIONS;
238241
return DW_DLV_ERROR;
@@ -299,6 +302,9 @@ generic_ehdr_from_64(dwarf_elf_object_access_internals_t* ep,
299302
ehdr->ge_shnum_extended = TRUE;
300303
} else {
301304
ehdr->ge_shnum_in_shnum = TRUE;
305+
if (!ehdr->ge_shnum) {
306+
return DW_DLV_NO_ENTRY;
307+
}
302308
if (ehdr->ge_shnum < 3) {
303309
*errcode = DW_DLE_TOO_FEW_SECTIONS;
304310
return DW_DLV_ERROR;

0 commit comments

Comments
 (0)