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.
This commit is contained in:
Alan Li 2022-10-12 18:32:07 +08:00 committed by GitHub
parent 75ece8e2a8
commit 42caec2552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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