From 12102d101af258d7a3e9695b736a189cd3658df1 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 6 Sep 2023 14:20:23 -0400 Subject: Fix crash in WeakMap during compaction WeakMap can crash during compaction because the st_insert could allocate memory. --- weakmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'weakmap.c') diff --git a/weakmap.c b/weakmap.c index d79f5b3f94..3c7fd43f9b 100644 --- a/weakmap.c +++ b/weakmap.c @@ -122,7 +122,11 @@ wmap_compact_table_i(st_data_t key, st_data_t val, st_data_t data) if (key_obj != new_key_obj) { *(VALUE *)key = new_key_obj; - st_insert(table, key, val); + DURING_GC_COULD_MALLOC_REGION_START(); + { + st_insert(table, key, val); + } + DURING_GC_COULD_MALLOC_REGION_END(); return ST_DELETE; } -- cgit v1.2.3