Commit 7206f5bd by Ian Lance Taylor

libbacktrace: don't crash if ELF file has no sections

Patch from Roland McGrath. Fixes #41
parent ca0de051
...@@ -2781,6 +2781,9 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, ...@@ -2781,6 +2781,9 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
backtrace_release_view (state, &shdr_view, error_callback, data); 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 /* To translate PC to file/line when using DWARF, we need to find
the .debug_info and .debug_line sections. */ the .debug_info and .debug_line sections. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment