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

From: Date: Thu, 08 Dec 2016 06:03:45 +0000
Subject: com php-src: Fix bug #73631 - Invalid read when wddx decodes empty boolean element: ext/wddx/tests/bug73631.phpt ext/wddx/wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96258@lists.php.net to get a copy of this message
Commit: 66fd44209d5ffcb9b3d1bc1b9fd8e35b485040c0 Author: Stanislav Malyshev <stas@php.net> Mon, 5 Dec 2016 21:40:55 -0800 Committer: Ferenc Kovacs <tyra3l@gmail.com> Thu, 8 Dec 2016 07:03:45 +0100 Parents: 9e89e72feb5a5b1029f1a0309ca4ffcb1c4732c4 Branches: PHP-5.6.29 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=66fd44209d5ffcb9b3d1bc1b9fd8e35b485040c0 Log: Fix bug #73631 - Invalid read when wddx decodes empty boolean element Bugs: https://bugs.php.net/73631 Changed paths: A ext/wddx/tests/bug73631.phpt M ext/wddx/wddx.c Diff: 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 (#96258) next »