diff options
| author | Stanislav Malyshev <stas@php.net> | 2016-09-25 19:53:59 -0700 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2016-10-12 17:51:15 +0200 |
| commit | f42cbd749cde1f91274c1d03df9024baba141a8f (patch) | |
| tree | f1e6c542b4c4b1799581a60c672db74dcc6d1436 /Zend/zend_API.c | |
| parent | efc1f33b58b0936539ea6ca1de345bd83c7e8f26 (diff) | |
| download | php-git-f42cbd749cde1f91274c1d03df9024baba141a8f.tar.gz | |
Fix bug #73147: Use After Free in PHP7 unserialize()
(cherry picked from commit 0e6fe3a4c96be2d3e88389a5776f878021b4c59f)
Diffstat (limited to 'Zend/zend_API.c')
| -rw-r--r-- | Zend/zend_API.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 81ab757940..5270d7fa13 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3847,6 +3847,24 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c } /* }}} */ +ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length) /* {{{ */ +{ + zval property; + zend_class_entry *old_scope = EG(scope); + + EG(scope) = scope; + + if (!Z_OBJ_HT_P(object)->unset_property) { + zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be unset", name, ZSTR_VAL(Z_OBJCE_P(object)->name)); + } + ZVAL_STRINGL(&property, name, name_length); + Z_OBJ_HT_P(object)->unset_property(object, &property, 0); + zval_ptr_dtor(&property); + + EG(scope) = old_scope; +} +/* }}} */ + ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value) /* {{{ */ { zval tmp; |
