From 7494efbb16abb1e9df5291fb1b05ded5517baba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Wed, 13 Jun 2018 19:09:10 +0200 Subject: [PATCH] eh_elf: detect eh_elf errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (No data, unimplemented data type, …) --- src/eh_elf/eh_elf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/eh_elf/eh_elf.c b/src/eh_elf/eh_elf.c index 95f3ce3e..380ee11f 100644 --- a/src/eh_elf/eh_elf.c +++ b/src/eh_elf/eh_elf.c @@ -114,6 +114,14 @@ int eh_elf_step_cursor(struct cursor *cursor) { ip - mmap_entry->offset, fetchw_here); + if(eh_elf_context.rbp + 1 == 0 + && eh_elf_context.rsp + 1 == 0 + && eh_elf_context.rip + 1 == 0) { + // Error, somehow + Debug(2, "eh_elf unwinding FAILED\n"); + return -3; + } + // Push back the data into libunwind's structures for (int i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) cursor->dwarf.loc[i] = DWARF_NULL_LOC;