Skip to content

Commit

Permalink
Remove final assert (#756)
Browse files Browse the repository at this point in the history
* remove `assert` in `GlibcHeapTcachebinsCommand.tcachebin()`

* Rephrased the error message in `tcachebin()`
  • Loading branch information
hugsy committed Dec 6, 2021
1 parent 04f847b commit 702858c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -7302,7 +7302,10 @@ def check_thread_ids(tids):
@staticmethod
def tcachebin(tcache_base, i):
"""Return the head chunk in tcache[i] and the number of chunks in the bin."""
assert i < GlibcHeapTcachebinsCommand.TCACHE_MAX_BINS, "index should be less then TCACHE_MAX_BINS"
if i >= GlibcHeapTcachebinsCommand.TCACHE_MAX_BINS:
err("Incorrect index value, index value must be between 0 and {}-1, given {}".format(GlibcHeapTcachebinsCommand.TCACHE_MAX_BINS, i))
return None, 0

tcache_chunk = GlibcChunk(tcache_base)

# Glibc changed the size of the tcache in version 2.30; this fix has
Expand Down

0 comments on commit 702858c

Please sign in to comment.