mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-03-21 01:39:07 +08:00
libbacktrace: don't crash if ELF file has no sections
Patch from Roland McGrath. Fixes #41
This commit is contained in:
3
elf.c
3
elf.c
@@ -2781,6 +2781,9 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
|
||||
backtrace_release_view (state, &shdr_view, error_callback, data);
|
||||
}
|
||||
|
||||
if (shnum == 0 || shstrndx == 0)
|
||||
goto fail;
|
||||
|
||||
/* To translate PC to file/line when using DWARF, we need to find
|
||||
the .debug_info and .debug_line sections. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user