]> granicus.if.org Git - php/commitdiff
Fixed NULL pointer dereference
authorDmitry Stogov <dmitry@zend.com>
Sat, 20 Feb 2021 08:20:29 +0000 (11:20 +0300)
committerDmitry Stogov <dmitry@zend.com>
Sat, 20 Feb 2021 08:20:29 +0000 (11:20 +0300)
Zend/zend_closures.c

index 38105a67f6a3d78d513004e1e798c7419b2865bf..2eda4f8f5c961895eb14891b7c38f64357f77f92 100644 (file)
@@ -620,7 +620,8 @@ static HashTable *zend_closure_get_gc(zend_object *obj, zval **table, int *n) /*
 
        *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL;
        *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0;
-       return (closure->func.type == ZEND_USER_FUNCTION) ?
+       return (closure->func.type == ZEND_USER_FUNCTION &&
+               closure->func.op_array.static_variables) ?
                ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL;
 }
 /* }}} */