diff options
| author | KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au> | 2024-03-30 12:58:01 +1100 |
|---|---|---|
| committer | KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au> | 2024-03-31 20:33:38 +1100 |
| commit | 9d0a5148ae062a0481a4a18fbeb9cfd01dc10428 (patch) | |
| tree | 639930e623a7cdc3bf17c190ab42520876063c0f | |
| parent | 174b67169975160aa682d9b2c6ac5ccde2652105 (diff) | |
Add missing RB_GC_GUARDs related to DATA_PTR
I discovered the problem in `compile.c` from a failing
TestIseqLoad#test_stressful_roundtrip test with ASAN enabled. The other
two changes in array.c and string.c I found by auditing similar usages
of DATA_PTR in the codebase.
[Bug #20402]
| -rw-r--r-- | array.c | 1 | ||||
| -rw-r--r-- | compile.c | 1 | ||||
| -rw-r--r-- | string.c | 1 |
3 files changed, 3 insertions, 0 deletions
@@ -6643,6 +6643,7 @@ ary_sample(rb_execution_context_t *ec, VALUE ary, VALUE randgen, VALUE nv, VALUE }); DATA_PTR(vmemo) = 0; st_free_table(memo); + RB_GC_GUARD(vmemo); } else { result = rb_ary_dup(ary); @@ -11318,6 +11318,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor, } } DATA_PTR(labels_wrapper) = 0; + RB_GC_GUARD(labels_wrapper); validate_labels(iseq, labels_table); if (!ret) return ret; return iseq_setup(iseq, anchor); @@ -1148,6 +1148,7 @@ str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_str_resize(newstr, olen); } DATA_PTR(econv_wrapper) = 0; + RB_GC_GUARD(econv_wrapper); rb_econv_close(ec); switch (ret) { case econv_finished: |
