1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix RC_DEBUG check for IS_NULL type

IS_NULL is set during GC, conservatively assume that it might have
been an object.
This commit is contained in:
Nikita Popov
2021-07-20 15:23:21 +02:00
parent bca1ebf529
commit 7572d9bdd3

View File

@@ -1143,10 +1143,15 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#if ZEND_RC_DEBUG
extern ZEND_API bool zend_rc_debug;
/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects.
* Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */
# define ZEND_RC_MOD_CHECK(p) do { \
if (zend_rc_debug && zval_gc_type((p)->u.type_info) != IS_OBJECT) { \
ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \
ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \
if (zend_rc_debug) { \
zend_uchar type = zval_gc_type((p)->u.type_info); \
if (type != IS_OBJECT && type != IS_NULL) { \
ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \
ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \
} \
} \
} while (0)
# define GC_MAKE_PERSISTENT_LOCAL(p) do { \