From 702858c8a05adec63d579518c4ccc298b70b79a7 Mon Sep 17 00:00:00 2001 From: hugsy Date: Mon, 6 Dec 2021 08:16:37 -0800 Subject: [PATCH] Remove final `assert` (#756) * remove `assert` in `GlibcHeapTcachebinsCommand.tcachebin()` * Rephrased the error message in `tcachebin()` --- gef.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gef.py b/gef.py index b650d9a9b..908c8d82c 100644 --- a/gef.py +++ b/gef.py @@ -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