fix unpacking bins tuples (#563)

* fix unpacking bins tuples

* pop type
pull/567/head
Paweł Płatek 7 years ago committed by Disconnect3d
parent cbec07c798
commit a12b5bf79c

@ -37,16 +37,17 @@ def format_bin(bins, verbose=False, offset=None):
offset = main_heap.chunk_key_offset('fd')
result = []
bins_type = bins.pop('type')
for size in bins:
b = bins[size]
count, is_chain_corrupted = None, False
# fastbins consists of only single linked list
if len(b) == 1: # fastbin:
if bins_type == 'fastbins':
chain_fd = b
# tcachebins consists of single linked list and entries count
elif len(b) == 2: # tcachebin:
elif bins_type == 'tcachebins':
chain_fd, count = b
# normal bins consists of double linked list and may be corrupted (we can detect corruption)
else: # normal bin

@ -434,6 +434,7 @@ class Heap(pwndbg.heap.heap.BaseHeap):
result[size] = chain
result['type'] = 'fastbins'
return result
@ -461,6 +462,7 @@ class Heap(pwndbg.heap.heap.BaseHeap):
result[size] = (chain, count)
result['type'] = 'tcachebins'
return result
@ -520,6 +522,7 @@ class Heap(pwndbg.heap.heap.BaseHeap):
result['all'] = chain
result['type'] = 'unsortedbin'
return result
@ -537,6 +540,7 @@ class Heap(pwndbg.heap.heap.BaseHeap):
result[size] = chain
result['type'] = 'smallbins'
return result
@ -554,6 +558,7 @@ class Heap(pwndbg.heap.heap.BaseHeap):
result[size] = chain
result['type'] = 'largebins'
return result

Loading…
Cancel
Save