summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-30 07:35:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-30 07:35:04 -0700
commitf3225cb0e6bfaf17709b0c171e77cd58fb198ce1 (patch)
tree45fbaa61e8d6bb924cc85db2955f9dd707420370
parentab99601555d48297af0897c022a8288283318100 (diff)
downloadtxr-f3225cb0e6bfaf17709b0c171e77cd58fb198ce1.tar.gz
txr-f3225cb0e6bfaf17709b0c171e77cd58fb198ce1.tar.bz2
txr-f3225cb0e6bfaf17709b0c171e77cd58fb198ce1.zip
tree: gc crash due to dummy object.
* tree.c (tr_rebuild): The dummy on-stack node we use in the rebuilding process must have its generation field set to 1 rather than 0, so it looks like a mature heap object rather than a baby object. Otherwise when its pointer is assigned to another node which happens to be gen 1, the on-stack dummy will be added to the checkobj array, and gc will try to mark it.
-rw-r--r--tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index 654deccf..ee1d37c4 100644
--- a/tree.c
+++ b/tree.c
@@ -327,7 +327,7 @@ static void tr_rebuild(val tree, struct tree *tr, val node,
val parent, ucnum size)
{
#if CONFIG_GEN_GC
- obj_t dummy = { { TNOD, 0, 0, { 0 }, 0 } };
+ obj_t dummy = { { TNOD, 0, 1, { 0 }, 0 } };
#else
obj_t dummy = { { TNOD, { 0 }, 0 } };
#endif