From a0e6a69696b073250875183e8690f35f36eb8e23 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 10 Dec 2016 10:14:39 +0300 Subject: [PATCH] Fix assertion in GC_steal_mark_stack for non-heap regions (similar to commit da2fcda) * mark.c (GC_steal_mark_stack): Replace top->mse_descr.w with descr in assertion; relax assertion condition for descr (length-containing mse_descr.w could be larger than the current GC heap size if mse_start points to a region in a stack or a program data root; e.g. it could happen if MemorySanitizer is used). --- mark.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mark.c b/mark.c index 167fa5a..e6b212e 100644 --- a/mark.c +++ b/mark.c @@ -968,9 +968,13 @@ STATIC mse * GC_steal_mark_stack(mse * low, mse * high, mse * local, ++top; top -> mse_descr.w = descr; top -> mse_start = p -> mse_start; - GC_ASSERT((top->mse_descr.w & GC_DS_TAGS) != GC_DS_LENGTH || - top->mse_descr.w < (word)GC_greatest_plausible_heap_addr - - (word)GC_least_plausible_heap_addr); + GC_ASSERT((descr & GC_DS_TAGS) != GC_DS_LENGTH + || descr < (word)GC_greatest_plausible_heap_addr + - (word)GC_least_plausible_heap_addr + || (word)(p->mse_start + descr) + <= (word)GC_least_plausible_heap_addr + || (word)p->mse_start + >= (word)GC_greatest_plausible_heap_addr); /* If this is a big object, count it as */ /* size/256 + 1 objects. */ ++i; -- 2.7.4