Skip to content

Commit

Permalink
Fix asan error when walking heap for T_PAYLOAD objects
Browse files Browse the repository at this point in the history
Related to https://bugs.ruby-lang.org/issues/18001

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
  • Loading branch information
eileencodes and tenderlove committed Jun 22, 2021
1 parent de779f4 commit 4f77a54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 4f77a54

Please sign in to comment.