(addr, max_pages=1024)
return addr
find_upper_boundary(addr, max_pages=1024) -> int

    Brute-force search the upper boundary of a memory mapping,
    by reading the first byte of each page, until an unmapped
    page is found.
find_upper_boundary(addr, max_pages=1024) -> int
find_upper_boundary ( addr max_pages = 1024 ) - > int
def find_upper_boundary(addr, max_pages=1024):
    """find_upper_boundary(addr, max_pages=1024) -> int

    Brute-force search the upper boundary of a memory mapping,
    by reading the first byte of each page, until an unmapped
    page is found.
    """
    addr = pwndbg.memory.page_align(int(addr))
    try:
        for i in range(max_pages):
            pwndbg.memory.read(addr, 1)
            # import sys
            # sys.stdout.write(hex(addr) + '\n')
            addr += pwndbg.memory.PAGE_SIZE

            # Sanity check in case a custom GDB server/stub
            # incorrectly returns a result from read
            # (this is most likely redundant, but its ok to keep it?)
            if addr > pwndbg.arch.ptrmask:
                return pwndbg.arch.ptrmask
    except gdb.MemoryError:
        pass
    return addr
def find_upper_boundary ( addr , max_pages = 1024 ) : addr = pwndbg . memory . page_align ( int ( addr ) ) try : for i in range ( max_pages ) : pwndbg . memory . read ( addr , 1 ) # import sys # sys.stdout.write(hex(addr) + '\n') addr += pwndbg . memory . PAGE_SIZE # Sanity check in case a custom GDB server/stub # incorrectly returns a result from read # (this is most likely redundant, but its ok to keep it?) if addr > pwndbg . arch . ptrmask : return pwndbg . arch . ptrmask except gdb . MemoryError : pass return addr