Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix GH-17162: zend_array_try_init() with dtor can cause engine UAF
This commit is contained in:
Niels Dossche 2024-12-15 20:12:12 +01:00
commit 08b14a57b8
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
3 changed files with 27 additions and 1 deletions

View file

@ -1485,7 +1485,10 @@ static zend_always_inline zval *zend_try_array_init_size(zval *zv, uint32_t size
}
zv = &ref->val;
}
zval_ptr_dtor(zv);
zval garbage;
ZVAL_COPY_VALUE(&garbage, zv);
ZVAL_NULL(zv);
zval_ptr_dtor(&garbage);
ZVAL_ARR(zv, arr);
return zv;
}