From 16067da0ced8a102d659179774daf99b5fceab81 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 25 Jan 2022 15:53:13 -0800 Subject: [PATCH] Guard hash k / v This ensures the key and value are written to the hash before they leave any registers --- hash.c | 4 ++++ st.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/hash.c b/hash.c index f032ef642a..df3338c99c 100644 --- a/hash.c +++ b/hash.c @@ -1050,6 +1050,10 @@ ar_update(VALUE hash, st_data_t key, } break; } + + RB_GC_GUARD(key); + RB_GC_GUARD(value); + return existing; } diff --git a/st.c b/st.c index 53e9dc8320..9f86ea3ad6 100644 --- a/st.c +++ b/st.c @@ -1443,6 +1443,8 @@ st_update(st_table *tab, st_data_t key, } break; } + RB_GC_GUARD(key); + RB_GC_GUARD(value); return existing; } -- 2.35.0