Skip to content

Conversation

@nikic
Copy link
Member

@nikic nikic commented Aug 8, 2019

This addresses the issue from #4489 (comment).

@nikic
Copy link
Member Author

nikic commented Aug 8, 2019

The issue is that nested data removal stops at any node that is not part of the root buffer. Because references aren't added to it, we always stop at references and may miss nested data that way.

ZEND_ASSERT(!ZEND_REF_HAS_TYPE_SOURCES(ref));
GC_REMOVE_FROM_BUFFER(ref);
i_zval_ptr_dtor(&ref->val);
efree_size(ref, sizeof(zend_reference));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some other places where the zend_reference may be deallocated (e.g. zend_assign_to_variable)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether we actually need to handle other places: We are only adding resources to the root buffer during garbage collection here, not before. So references with a root buffer entry shouldn't be visible from normal code.

@nikic
Copy link
Member Author

nikic commented Aug 9, 2019

Fixed by 9b43e29 instead.

@nikic nikic closed this Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants