1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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>
This commit is contained in:
eileencodes 2021-06-22 14:00:16 -04:00 committed by Aaron Patterson
parent de779f4a62
commit 4f77a54f07
Notes: git 2021-06-23 06:34:36 +09:00

4
gc.c
View file

@ -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)) {