From e381622a9af715672c6a88cde6eece114ba50939 Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Sat, 11 Sep 2021 19:49:16 -0600 Subject: [PATCH] add NULL check in gc.c to avoid UB After the UB was fixed in value.c, I tried running the build again and encoutered another instance of UB in gc.c. With this fixed I can now build janet with ubsan enabled, meaning there's no more UB encountered in janet_boot during the build. --- src/core/gc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/gc.c b/src/core/gc.c index b1efbe00..1a320abd 100644 --- a/src/core/gc.c +++ b/src/core/gc.c @@ -123,6 +123,8 @@ static void janet_mark_abstract(void *adata) { /* Mark a bunch of items in memory */ static void janet_mark_many(const Janet *values, int32_t n) { + if (values == NULL) + return; const Janet *end = values + n; while (values < end) { janet_mark(*values);