aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2021-06-22 14:00:16 -0400
committerAaron Patterson <aaron.patterson@gmail.com>2021-06-22 14:34:08 -0700
commit4f77a54f07b17b19e0dd329877ce9895d98c6cad (patch)
treee76458dc371c2aa34db31260f89ee2be1e0c0a14 /gc.c
parentde779f4a620f408b72004a06545455f5a51a8584 (diff)
downloadruby-4f77a54f07b17b19e0dd329877ce9895d98c6cad.tar.gz
Fix asan error when walking heap for T_PAYLOAD objects
Related to https://bugs.ruby-lang.org/issues/18001 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 09420deac2..44a1992cc1 100644
--- a/gc.c
+++ b/gc.c
@@ -3552,16 +3552,18 @@ objspace_each_objects_try(VALUE arg)
while (cursor_end < pend) {
int payload_len = 0;
+#if USE_RVARGC
while (cursor_end < pend && BUILTIN_TYPE((VALUE)cursor_end) != T_PAYLOAD) {
cursor_end++;
}
-#if USE_RVARGC
//Make sure the Payload header slot is yielded
if (cursor_end < pend && BUILTIN_TYPE((VALUE)cursor_end) == T_PAYLOAD) {
payload_len = RPAYLOAD_LEN((VALUE)cursor_end);
cursor_end++;
}
+#else
+ cursor_end = pend;
#endif
if ((*data->callback)(pstart, cursor_end, sizeof(RVALUE), data->data)) {