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 коммит произвёл Aaron Patterson
Родитель de779f4a62
Коммит 4f77a54f07
1 изменённых файлов: 3 добавлений и 1 удалений

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