diff options
| author | Stanislav Malyshev <stas@php.net> | 2015-08-04 16:14:24 -0700 |
|---|---|---|
| committer | Stanislav Malyshev <stas@php.net> | 2015-08-04 16:14:24 -0700 |
| commit | 97047e7665368d0cf30501f7a4b6a124de25957b (patch) | |
| tree | c3ed6c3e67c935d6cd0e782695437c9ab9ded5d4 /Zend/zend_exceptions.c | |
| parent | 668ecaa606b3203311b3329fcbd49b59f715e1e4 (diff) | |
| parent | ed709d5aa01375beb7e0b408c4027bbb9cfb52b6 (diff) | |
| download | php-git-97047e7665368d0cf30501f7a4b6a124de25957b.tar.gz | |
Merge branch 'PHP-5.6'
* PHP-5.6:
update NEWS
fix test
update NEWS
Fix bug #70019 - limit extracted files to given directory
Do not do convert_to_* on unserialize, it messes up references
Fix #69793 - limit what we accept when unserializing exception
Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
ignore signatures for packages too
Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
Fixed bug #69892
Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
Improved fix for Bug #69441
Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
Fix bug #70081: check types for SOAP variables
Conflicts:
Zend/zend_exceptions.c
ext/date/php_date.c
ext/openssl/openssl.c
ext/phar/phar_internal.h
ext/soap/php_http.c
ext/spl/spl_array.c
ext/spl/spl_dllist.c
ext/spl/spl_observer.c
ext/standard/tests/serialize/bug69152.phpt
sapi/cli/tests/005.phpt
Diffstat (limited to 'Zend/zend_exceptions.c')
| -rw-r--r-- | Zend/zend_exceptions.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 5d6cc59259..51ea2319bf 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -203,7 +203,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, array_init(&trace); } Z_SET_REFCOUNT(trace, 0); - + base_ce = i_get_exception_base(&obj); if (EXPECTED(class_type != zend_ce_parse_error || !(filename = zend_get_compiled_filename()))) { @@ -279,6 +279,32 @@ ZEND_METHOD(exception, __construct) } /* }}} */ +/* {{{ proto Exception::__wakeup() + Exception unserialize checks */ +#define CHECK_EXC_TYPE(name, type) \ + zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &value); \ + if(value && Z_TYPE_P(value) != type) { \ + zval *tmp; \ + MAKE_STD_ZVAL(tmp); \ + ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \ + Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \ + zval_ptr_dtor(&tmp); \ + } + +ZEND_METHOD(exception, __wakeup) +{ + zval value; + zval *object = getThis(); + CHECK_EXC_TYPE("message", IS_STRING); + CHECK_EXC_TYPE("string", IS_STRING); + CHECK_EXC_TYPE("code", IS_LONG); + CHECK_EXC_TYPE("file", IS_STRING); + CHECK_EXC_TYPE("line", IS_LONG); + CHECK_EXC_TYPE("trace", IS_ARRAY); + CHECK_EXC_TYPE("previous", IS_OBJECT); +} +/* }}} */ + /* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Throwable previous]]]) ErrorException constructor */ ZEND_METHOD(error_exception, __construct) @@ -608,7 +634,7 @@ ZEND_METHOD(exception, getTraceAsString) uint32_t num = 0; DEFAULT_0_PARAMS; - + object = getThis(); base_ce = i_get_exception_base(object); @@ -782,6 +808,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry default_exception_functions[] = { ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC) + ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -812,7 +839,7 @@ static const zend_function_entry error_exception_functions[] = { void zend_register_default_exception(void) /* {{{ */ { zend_class_entry ce; - + REGISTER_MAGIC_INTERFACE(throwable, Throwable); memcpy(&default_exception_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -868,7 +895,7 @@ void zend_register_default_exception(void) /* {{{ */ /* }}} */ /* {{{ Deprecated - Use zend_ce_exception directly instead */ -ZEND_API zend_class_entry *zend_exception_get_default(void) +ZEND_API zend_class_entry *zend_exception_get_default(void) { return zend_ce_exception; } |
