From da718dcac360737b7924ed63eb5319881c073aee Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 23 Jul 2021 15:46:42 -0400 Subject: [PATCH] Fix off-by-one error with non-closure GC arg --- CHANGELOG.md | 1 + gc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2251a00f..53ec98f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Bug Fixes - Properly handle vectors literals at the top level of compiled code. Previously this could lead to segmentation faults (!!) at runtime. - Fixed a bug in `make-list` that consumed all available memory when passing a negative list length. - Allow a record type to contain fields that are not initialized by the constructor. +- Fix off-by-one error unpacking arguments when calling a primitive as the continuation after a garbage collection. Bug Fixes for C Compiler Warnings diff --git a/gc.c b/gc.c index b9531aca..9483d019 100644 --- a/gc.c +++ b/gc.c @@ -2916,7 +2916,7 @@ void gc_mutator_thread_runnable(gc_thread_data * thd, object result, object mayb // Collector didn't do anything; make a normal continuation call if (type_of(thd->gc_cont) == pair_tag || prim(thd->gc_cont)) { thd->gc_args[0] = result; - Cyc_apply_from_buf(thd, 1, thd->gc_cont, thd->gc_args); + Cyc_apply_from_buf(thd, 2, thd->gc_cont, thd->gc_args); } else { object buf[1] = {result}; (((closure) (thd->gc_cont))->fn) (thd, thd->gc_cont, 1, buf);