com php-src: Fix bug #72860: wddx_deserialize use-after-fre e: ext/wddx/tests/bug72860.phpt ext/wddx/wddx .c

From: Date: Tue, 13 Sep 2016 04:04:23 +0000
Subject: com php-src: Fix bug #72860: wddx_deserialize use-after-fre e: ext/wddx/tests/bug72860.phpt ext/wddx/wddx .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94446@lists.php.net to get a copy of this message
Commit: b88393f08a558eec14964a55d3c680fe67407712 Author: Stanislav Malyshev <stas@php.net> Mon, 5 Sep 2016 23:42:31 -0700 Parents: 65c8caafa83ca78a8b2fa22257b4dea85b6114e5 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b88393f08a558eec14964a55d3c680fe67407712 Log: Fix bug #72860: wddx_deserialize use-after-free Bugs: https://bugs.php.net/72860 Changed paths: A ext/wddx/tests/bug72860.phpt M ext/wddx/wddx.c Diff: diff --git a/ext/wddx/tests/bug72860.phpt b/ext/wddx/tests/bug72860.phpt new file mode 100644 index 0000000..6385457 --- /dev/null +++ b/ext/wddx/tests/bug72860.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #72860: wddx_deserialize use-after-free +--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'> + <recordset fieldNames='F'> + <field name='F'> + </recordset> +</wddxPacket> +XML; + +var_dump(wddx_deserialize($xml)); +?> +DONE +--EXPECT-- +NULL +DONE \ No newline at end of file diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index d7bd295..b02d2f0 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -230,7 +230,8 @@ static int wddx_stack_destroy(wddx_stack *stack) if (stack->elements) { for (i = 0; i < stack->top; i++) { - if (((st_entry *)stack->elements[i])->data) { + if (((st_entry *)stack->elements[i])->data + && ((st_entry *)stack->elements[i])->type != ST_FIELD) { zval_ptr_dtor(&((st_entry *)stack->elements[i])->data); } if (((st_entry *)stack->elements[i])->varname) {

« previous php.cvs (#94446) next »