1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 19:19:53 +00:00

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.
This commit is contained in:
Jonathan Marler 2021-09-11 19:49:16 -06:00
parent b799223ebc
commit e381622a9a

View File

@ -123,6 +123,8 @@ static void janet_mark_abstract(void *adata) {
/* Mark a bunch of items in memory */ /* Mark a bunch of items in memory */
static void janet_mark_many(const Janet *values, int32_t n) { static void janet_mark_many(const Janet *values, int32_t n) {
if (values == NULL)
return;
const Janet *end = values + n; const Janet *end = values + n;
while (values < end) { while (values < end) {
janet_mark(*values); janet_mark(*values);