Skip to content

Commit 604827b

Browse files
committed
Fixed bug #73173
Patch by tloi at fortinet dot com.
1 parent cfee511 commit 604827b

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ PHP NEWS
1111
- SPL:
1212
. Fixed bug #73471 (PHP freezes with AppendIterator). (jhdxr)
1313

14+
- Wddx:
15+
. Fixed bug #73173 (huge memleak when wddx_unserialize).
16+
(tloi at fortinet dot com)
17+
1418
- zlib:
1519
. Fixed bug #73944 (dictionary option of inflate_init() does not work).
1620
(wapmorgan)

ext/wddx/tests/bug73173.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Bug #73173: huge memleak when wddx_unserialize
3+
--SKIPIF--
4+
<?php if (!extension_loaded("wddx")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
8+
$xml=<<<XML
9+
<?xml version='1.0'?>
10+
<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'>
11+
<wddxPacket>
12+
<var name="
13+
XML;
14+
15+
$xml .= str_repeat('F',0x80000);
16+
17+
$xml .= <<<XML
18+
">
19+
</wddxPacket>
20+
XML;
21+
var_dump(wddx_deserialize($xml));
22+
23+
?>
24+
--EXPECT--
25+
NULL

ext/wddx/wddx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ static int wddx_stack_destroy(wddx_stack *stack)
241241
}
242242
efree(stack->elements);
243243
}
244+
if (stack->varname) {
245+
efree(stack->varname);
246+
}
244247
return SUCCESS;
245248
}
246249
/* }}} */

0 commit comments

Comments
 (0)