summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2021-09-15 10:54:48 -0500
committerDamien George <damien@micropython.org>2022-12-08 14:35:08 +1100
commitd75ff422972189232345108ecd2037ac148acda1 (patch)
treeaf6f447117c60e3d0416072442ccb98ee16c0a1b /py
parent9f434dd8de3c327c194d531c5496f603d6288d98 (diff)
unix/coverage: Add extra GC coverage test for ATB gap byte.
The assertion that is added here (to gc.c) fails when running this new test if ALLOC_TABLE_GAP_BYTE is set to 0. Signed-off-by: Jeff Epler <jepler@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r--py/gc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/gc.c b/py/gc.c
index 99eacfbe6..3c106fd67 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -297,6 +297,9 @@ STATIC void gc_mark_subtree(size_t block)
n_blocks += 1;
} while (ATB_GET_KIND(area, block + n_blocks) == AT_TAIL);
+ // check that the consecutive blocks didn't overflow past the end of the area
+ assert(area->gc_pool_start + (block + n_blocks) * BYTES_PER_BLOCK <= area->gc_pool_end);
+
// check this block's children
void **ptrs = (void **)PTR_FROM_BLOCK(area, block);
for (size_t i = n_blocks * BYTES_PER_BLOCK / sizeof(void *); i > 0; i--, ptrs++) {