com php-src: Fix bug #73631 - Invalid read when wddx decodes empty boolean element: NEWS ext/wddx/tests/bug73631.phpt ext/wddx/wddx.c

From: Date: Tue, 06 Dec 2016 05:40:55 +0000
Subject: com php-src: Fix bug #73631 - Invalid read when wddx decodes empty boolean element: NEWS ext/wddx/tests/bug73631.phpt ext/wddx/wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96194@lists.php.net to get a copy of this message
Commit: 266ecb6d0a1ab5a37b4d652ca774a8adc4b06578 Author: Stanislav Malyshev <stas@php.net> Mon, 5 Dec 2016 21:40:55 -0800 Parents: cf2496140dfa43757870ddaf827961079a29fee1 Branches: PHP-5.6 PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=266ecb6d0a1ab5a37b4d652ca774a8adc4b06578 Log: Fix bug #73631 - Invalid read when wddx decodes empty boolean element Bugs: https://bugs.php.net/73631 Changed paths: M NEWS A ext/wddx/tests/bug73631.phpt M ext/wddx/wddx.c Diff: diff --git a/NEWS b/NEWS index bdefade..a5c3bd1 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ PHP NEWS . Fixed bug #68447 (grapheme_extract take an extra trailing character). (SATŌ Kentarō) +- WDDX: + . Fixed bug #73631 (Memory leak due to invalid wddx stack processing). + (bughunter at fosec dot vn). + 08 Dec 2016, PHP 5.6.29 - Mbstring: diff --git a/ext/wddx/tests/bug73631.phpt b/ext/wddx/tests/bug73631.phpt new file mode 100644 index 0000000..5e37ae8 --- /dev/null +++ b/ext/wddx/tests/bug73631.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #73631 (Memory leak due to invalid wddx stack processing) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php +$xml = <<<EOF +<?xml version="1.0" ?> +<wddxPacket version="1.0"> +<number>1234</number> +<binary><boolean/></binary> +</wddxPacket> +EOF; +$wddx = wddx_deserialize($xml); +var_dump($wddx); +?> +--EXPECTF-- +int(1234) + diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 069ea12..0cee16b 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -811,6 +811,11 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X php_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1])); break; } + } else { + ent.type = ST_BOOLEAN; + SET_STACK_VARNAME; + ZVAL_FALSE(&ent.data); + wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } } else if (!strcmp(name, EL_NULL)) { ent.type = ST_NULL;

« previous php.cvs (#96194) next »