Fix use-after-free with yield from in yield_from_multi_tree_single_nodes.phpt

Prevent release of generator children during destruction
This commit is contained in:
Bob Weinand 2020-09-14 23:05:28 +02:00
parent f51bbcc2b2
commit 452f7b0d41

View File

@ -232,7 +232,9 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
child = (zend_generator *) Z_PTR_P(zend_hash_get_current_data(generator->node.child.ht));
}
GC_ADD_FLAGS(&child->std, IS_OBJ_DESTRUCTOR_CALLED);
GC_ADDREF(&child->std); /* must not be released during destructor */
zend_generator_dtor_storage(&child->std);
OBJ_RELEASE(&child->std);
}
}
if (EXPECTED(generator->node.children == 0)) {