summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-08-09 13:39:59 +0300
committerDmitry Stogov <dmitry@zend.com>2019-08-09 13:39:59 +0300
commit21a0a28fd09fc5b0df6a7dc139f0fddbdcec7b62 (patch)
treee60d237963dd91d5a50741538ed74a6f95166437
parent5ef1a30aaf3528dd805b746dbddbce00b667c032 (diff)
parent2e2cd65d7317d8a196d8e260a1a80dd06a226571 (diff)
downloadphp-git-21a0a28fd09fc5b0df6a7dc139f0fddbdcec7b62.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Added asserts to catch GC errors when refcount goes below zero.
-rw-r--r--Zend/zend_gc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index 8b9ee17632..60fa7fdd15 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -829,6 +829,7 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
while (zv != end) {
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
+ ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
GC_DELREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
@@ -839,6 +840,7 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
}
if (EXPECTED(!ht)) {
ref = Z_COUNTED_P(zv);
+ ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
GC_DELREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
@@ -859,6 +861,7 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
} else if (GC_TYPE(ref) == IS_REFERENCE) {
if (Z_REFCOUNTED(((zend_reference*)ref)->val)) {
ref = Z_COUNTED(((zend_reference*)ref)->val);
+ ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
GC_DELREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
@@ -891,6 +894,7 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
}
if (Z_REFCOUNTED_P(zv)) {
ref = Z_COUNTED_P(zv);
+ ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
GC_DELREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);
@@ -904,6 +908,7 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
zv = Z_INDIRECT_P(zv);
}
ref = Z_COUNTED_P(zv);
+ ZEND_ASSERT(GC_REFCOUNT(ref) > 0);
GC_DELREF(ref);
if (!GC_REF_CHECK_COLOR(ref, GC_GREY)) {
GC_REF_SET_COLOR(ref, GC_GREY);