com php-src: re-apply the patch from 1785d2b805f64eaaacf98c14c9e13107bf085ab1: ext/wddx/tests/bug70741.phpt ext/wddx/wddx.c

From: Date: Tue, 05 Jan 2016 12:34:14 +0000
Subject: com php-src: re-apply the patch from 1785d2b805f64eaaacf98c14c9e13107bf085ab1: ext/wddx/tests/bug70741.phpt ext/wddx/wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90542@lists.php.net to get a copy of this message
Commit: 96963854819888980f388267a462a56826c07ced Author: Anatol Belski <ab@php.net> Mon, 4 Jan 2016 17:52:37 +0100 Parents: 6328074de3462cb5bcb0cb2446f7b6dae6c3f7fe Branches: PHP-7.0.2 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=96963854819888980f388267a462a56826c07ced Log: re-apply the patch from 1785d2b805f64eaaacf98c14c9e13107bf085ab1 too many conflicts to cherry-pick Changed paths: A ext/wddx/tests/bug70741.phpt M ext/wddx/wddx.c Diff: diff --git a/ext/wddx/tests/bug70741.phpt b/ext/wddx/tests/bug70741.phpt new file mode 100644 index 0000000..9c7e09b --- /dev/null +++ b/ext/wddx/tests/bug70741.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #70741 (Session WDDX Packet Deserialization Type Confusion Vulnerability) +--SKIPIF-- +<?php +if (!extension_loaded("wddx")) print "skip"; +?> +--FILE-- +<?php +ini_set('session.serialize_handler', 'wddx'); +session_start(); + +$hashtable = str_repeat('A', 66); +$wddx = "<?xml version='1.0'?> +<wddxPacket version='1.0'> +<header/> + <data> + <string>$hashtable</string> + </data> +</wddxPacket>"; +session_decode($wddx); +?> +DONE +--EXPECTF-- + +Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d +DONE \ No newline at end of file diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index f6efa60..c1027f7 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -298,6 +298,10 @@ PS_SERIALIZER_DECODE_FUNC(wddx) ZVAL_UNDEF(&retval); if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { + if (Z_TYPE(retval) != IS_ARRAY) { + zval_dtor(&retval); + return FAILURE; + } ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { if (key == NULL) { key = zend_long_to_str(idx);

« previous php.cvs (#90542) next »