From 42caec255237751710b437ac5e557df3777ab80f Mon Sep 17 00:00:00 2001 From: Alan Li <61896187+lebr0nli@users.noreply.github.com> Date: Wed, 12 Oct 2022 18:32:07 +0800 Subject: [PATCH] Fix the bug in the heuristic for `main_arena` and `mp_` (#1273) * Fix the bug when searching the struct of `main_arena` and `mp_` in the memory. --- pwndbg/heap/ptmalloc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwndbg/heap/ptmalloc.py b/pwndbg/heap/ptmalloc.py index 1c603e491..43197b090 100644 --- a/pwndbg/heap/ptmalloc.py +++ b/pwndbg/heap/ptmalloc.py @@ -1031,7 +1031,7 @@ class HeuristicHeap(Heap): tmp_arena = self.malloc_state(tmp_next) try: tmp_next = int(tmp_arena["next"]) - except gdb.MemoryError: + except (gdb.MemoryError, gdb.error, OverflowError): # tmp_arena->next is not valid, break break if found: @@ -1558,7 +1558,7 @@ class HeuristicHeap(Heap): or pwndbg.vmmap.find(self._mp_addr) is None and self.possible_page_of_symbols ): - libc_page = self.possible_page_of_symbols.vaddr + libc_page = self.possible_page_of_symbols # try to find sbrk_base via main_arena or vmmap # TODO/FIXME: If mp_.sbrk_base is not same as heap region start, this will fail