Skip to content

Commit 7206f5b

Browse files
libbacktrace: don't crash if ELF file has no sections
Patch from Roland McGrath. Fixes #41
1 parent ca0de05 commit 7206f5b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

elf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,9 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
27812781
backtrace_release_view (state, &shdr_view, error_callback, data);
27822782
}
27832783

2784+
if (shnum == 0 || shstrndx == 0)
2785+
goto fail;
2786+
27842787
/* To translate PC to file/line when using DWARF, we need to find
27852788
the .debug_info and .debug_line sections. */
27862789

0 commit comments

Comments
 (0)