diff options
author | Stanislav Malyshev <stas@php.net> | 2016-08-10 23:43:56 -0700 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-08-16 12:46:29 +0200 |
commit | 0c8a2a2cd1056b7dc403eacb5d2c0eec6ce47c6f (patch) | |
tree | 8222cfff70e9ff8ebc901d0c3a04f8bb7f95ee72 /ext/wddx | |
parent | 67d0fe39ee554563476ecae13c626580ae1a6612 (diff) | |
download | php-git-0c8a2a2cd1056b7dc403eacb5d2c0eec6ce47c6f.tar.gz |
Fix for bug #72790 and bug #72799
(cherry picked from commit a14fdb9746262549bbbb96abb87338bacd147e1b)
Conflicts:
ext/wddx/wddx.c
Diffstat (limited to 'ext/wddx')
-rw-r--r-- | ext/wddx/tests/bug72790.phpt | 35 | ||||
-rw-r--r-- | ext/wddx/tests/bug72799.phpt | 28 | ||||
-rw-r--r-- | ext/wddx/wddx.c | 2 |
3 files changed, 64 insertions, 1 deletions
diff --git a/ext/wddx/tests/bug72790.phpt b/ext/wddx/tests/bug72790.phpt new file mode 100644 index 0000000000..a60524bdaf --- /dev/null +++ b/ext/wddx/tests/bug72790.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug 72790: wddx_deserialize null dereference with invalid xml +--SKIPIF-- +<?php +if (!extension_loaded('wddx')) { + die('skip. wddx not available'); +} +?> +--FILE-- +<?php + +$xml = <<< XML +<?xml version='1.0' ?> +<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'> +<wddxPacket version='1.0'> + |array> + <var name="XXXX"> + <boolean value="this"> + </boolean> + </var> + <var name="YYYY"> + <var name="UUUU"> + <var name="EZEZ"> + </var> + </var> + </var> + </array> +</wddxPacket> +XML; + +$array = wddx_deserialize($xml); +var_dump($array); +?> +--EXPECT-- +NULL
\ No newline at end of file diff --git a/ext/wddx/tests/bug72799.phpt b/ext/wddx/tests/bug72799.phpt new file mode 100644 index 0000000000..5861d5538f --- /dev/null +++ b/ext/wddx/tests/bug72799.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #72799: wddx_deserialize null dereference in php_wddx_pop_element +--SKIPIF-- +<?php +if (!extension_loaded('wddx')) { + die('skip. wddx not available'); +} +?> +--FILE-- +<?php + +$xml = <<<XML +<?xml version='1.0'?> +<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'> +<wddxPacket version="1.0"> + <var name="XXXX"> + <boolean value="1"> + <dateTime>1998-06-12T04:32:12+00</dateTime> + </boolean> + </var> +</wddxPacket> +XML; + +$array = wddx_deserialize($xml); +var_dump($array); +?> +--EXPECT-- +NULL
\ No newline at end of file diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index d28cb7a0ac..11cf0be62e 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -886,10 +886,10 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (Z_TYPE(ent1->data) == IS_UNDEF) { if (stack->top > 1) { stack->top--; + efree(ent1); } else { stack->done = 1; } - efree(ent1); return; } |