com php-src: Handle reallocated root buffer during GC destroy phase: Zend/zend_gc.c

From: Date: Fri, 15 Nov 2019 14:53:49 +0000
Subject: com php-src: Handle reallocated root buffer during GC destroy phase: Zend/zend_gc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-109267@lists.php.net to get a copy of this message
Commit: 3f4a15113c50d2e86a59db8d41fb0a102f43d1c2 Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 15 Nov 2019 15:53:49 +0100 Parents: 51ac4e302ca2d7c7466e6ab98c97a1435f51e7a2 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3f4a15113c50d2e86a59db8d41fb0a102f43d1c2 Log: Handle reallocated root buffer during GC destroy phase We no longer protect GC during the destroy phase, so we need to deal with buffer reallocation. Possible fix for bug #78811. Bugs: https://bugs.php.net/78811 Changed paths: M Zend/zend_gc.c Diff: diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 8b242c003dd..c36f4e7ced4 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -1547,11 +1547,11 @@ ZEND_API int zend_gc_collect_cycles(void) } } - /* Destroy zvals */ + /* Destroy zvals. The root buffer may be reallocated. */ GC_TRACE("Destroying zvals"); - current = GC_IDX2PTR(GC_FIRST_ROOT); - last = GC_IDX2PTR(GC_G(first_unused)); - while (current != last) { + idx = GC_FIRST_ROOT; + while (idx != end) { + current = GC_IDX2PTR(idx); if (GC_IS_GARBAGE(current->ref)) { p = GC_GET_PTR(current->ref); GC_TRACE_REF(p, "destroying"); @@ -1582,11 +1582,12 @@ ZEND_API int zend_gc_collect_cycles(void) zend_hash_destroy(arr); } } - current++; + idx++; } /* Free objects */ current = GC_IDX2PTR(GC_FIRST_ROOT); + last = GC_IDX2PTR(end); while (current != last) { if (GC_IS_GARBAGE(current->ref)) { p = GC_GET_PTR(current->ref);

« previous php.cvs (#109267) next »