Skip to content

ptmalloc2 ¤

Functions:

  • read_chunk

    Read a chunk's metadata.

  • format_bin
  • print_no_arena_found_error
  • print_no_tcache_bins_found_error
  • heap

    Iteratively print chunks on a heap, default to the current thread's

  • hi
  • arena

    Print the contents of an arena, default to the current thread's arena.

  • arenas

    Lists this process's arenas.

  • tcache

    Print a thread's tcache contents, default to the current thread's

  • mp

    Print the mp_ struct's contents.

  • top_chunk

    Print relevant information about an arena's top chunk, default to the

  • malloc_chunk

    Print a malloc_chunk struct's contents.

  • bins

    Print the contents of all an arena's bins and a thread's tcache,

  • fastbins

    Print the contents of an arena's fastbins, default to the current

  • unsortedbin

    Print the contents of an arena's unsortedbin, default to the current

  • smallbins

    Print the contents of an arena's smallbins, default to the current

  • largebins

    Print the contents of an arena's largebins, default to the current

  • tcachebins

    Print the contents of a tcache, default to the current thread's tcache.

  • find_fake_fast

    Find candidate fake fast chunks overlapping the specified address.

  • vis_heap_chunks

    Visualize chunks on a heap, default to the current arena's active heap.

  • bin_ascii
  • bin_labels_mapping

    Returns all potential bin labels for all potential addresses

  • try_free
  • try_unlink

Attributes:

parser module-attribute ¤

parser = ArgumentParser(
    description="Visualize chunks on a heap.\n\nDefault to the current arena's active heap."
)

group module-attribute ¤

group = add_mutually_exclusive_group()

VALID_CHARS module-attribute ¤

VALID_CHARS = list(map(ord, set(printable) - set('\t\r\n\x0c\x0b')))

try_free_parser module-attribute ¤

try_free_parser = ArgumentParser(
    description="Check what would happen if free was called with given address."
)

read_chunk ¤

read_chunk(addr: int) -> dict[str, int]

Read a chunk's metadata.

format_bin ¤

format_bin(
    bins: Bins, verbose: bool = False, offset: int | None = None
) -> list[str]

print_no_arena_found_error ¤

print_no_arena_found_error(tid=None) -> None

print_no_tcache_bins_found_error ¤

print_no_tcache_bins_found_error(tid: int | None = None) -> None

heap ¤

heap(
    addr: int | None = None, verbose: bool = False, simple: bool = False
) -> None

Iteratively print chunks on a heap, default to the current thread's active heap.

hi ¤

hi(
    addr: int, verbose: bool = False, simple: bool = False, fake: bool = False
) -> None

arena ¤

arena(addr: int | None = None) -> None

Print the contents of an arena, default to the current thread's arena.

arenas ¤

arenas() -> None

Lists this process's arenas.

tcache ¤

tcache(addr: int | None = None) -> None

Print a thread's tcache contents, default to the current thread's tcache.

mp ¤

mp() -> None

Print the mp_ struct's contents.

top_chunk ¤

top_chunk(addr: int | None = None) -> None

Print relevant information about an arena's top chunk, default to the current thread's arena.

malloc_chunk ¤

malloc_chunk(
    addr: int,
    fake: bool = False,
    verbose: bool = False,
    simple: bool = False,
    next: int = 0,
    dump: bool = False,
) -> None

Print a malloc_chunk struct's contents.

bins ¤

bins(addr: int | None = None, tcache_addr: int | None = None) -> None

Print the contents of all an arena's bins and a thread's tcache, default to the current thread's arena and tcache.

fastbins ¤

fastbins(addr: int | None = None, verbose: bool = False) -> None

Print the contents of an arena's fastbins, default to the current thread's arena.

unsortedbin ¤

unsortedbin(addr: int | None = None, verbose: bool = False) -> None

Print the contents of an arena's unsortedbin, default to the current thread's arena.

smallbins ¤

smallbins(addr: int | None = None, verbose: bool = False) -> None

Print the contents of an arena's smallbins, default to the current thread's arena.

largebins ¤

largebins(addr: int | None = None, verbose: bool = False) -> None

Print the contents of an arena's largebins, default to the current thread's arena.

tcachebins ¤

tcachebins(addr: int | None = None, verbose: bool = False) -> None

Print the contents of a tcache, default to the current thread's tcache.

find_fake_fast ¤

find_fake_fast(
    target_address: int,
    max_candidate_size: int | None = None,
    align: bool = False,
    glibc_fastbin_bug: bool = False,
    partial_overwrite: bool = False,
) -> None

Find candidate fake fast chunks overlapping the specified address.

vis_heap_chunks ¤

vis_heap_chunks(
    addr: int | None = None,
    count: int | None = None,
    beyond_top: bool = False,
    no_truncate: bool = False,
    all_chunks: bool = False,
) -> None

Visualize chunks on a heap, default to the current arena's active heap.

bin_ascii ¤

bin_ascii(bs)

bin_labels_mapping ¤

bin_labels_mapping(collections)

Returns all potential bin labels for all potential addresses We precompute all of them because doing this on demand was too slow and inefficient See #1675 for more details

try_free ¤

try_free(addr: str | int) -> None
try_unlink(addr: int) -> None