com php-src: Fix bug #72750: wddx_deserialize null derefe rence: ext/wddx/tests/bug72750.phpt ext/wddx/ wddx.c

From: Date: Wed, 17 Aug 2016 11:45:00 +0000
Subject: com php-src: Fix bug #72750: wddx_deserialize null derefe rence: ext/wddx/tests/bug72750.phpt ext/wddx/ wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93898@lists.php.net to get a copy of this message
Commit: b2d89c93e85504ccfcd865213685b89ec1cafcf9 Author: Stanislav Malyshev <stas@php.net> Sun, 7 Aug 2016 16:26:52 -0700 Committer: Anatol Belski <ab@php.net> Wed, 17 Aug 2016 13:45:00 +0200 Parents: 4dd455c6d28064f3d56ec2c928c37ff3ac6f38b8 Branches: PHP-7.0.10 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b2d89c93e85504ccfcd865213685b89ec1cafcf9 Log: Fix bug #72750: wddx_deserialize null dereference (cherry picked from commit 6930a1d12c47aa1d2675837852910d177b0ceb11) Conflicts: ext/wddx/wddx.c (cherry picked from commit f1486f0fd63e888028e625a5ae02f10cc729c4c7) Bugs: https://bugs.php.net/72750 Changed paths: A ext/wddx/tests/bug72750.phpt M ext/wddx/wddx.c Diff: diff --git a/ext/wddx/tests/bug72750.phpt b/ext/wddx/tests/bug72750.phpt new file mode 100644 index 0000000..3a6794d --- /dev/null +++ b/ext/wddx/tests/bug72750.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #72750: wddx_deserialize null dereference +--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'> +<header/> + <data> + <struct> + <var name='aBinary'> + <binary length='11'>\\tYmluYXJRhdGE=</binary> + </var> + </struct> + </data> +</wddxPacket> +XML; + +$array = wddx_deserialize($xml); +var_dump($array); +?> +--EXPECT-- +array(1) { + ["aBinary"]=> + string(0) "" +} diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 11cf0be..40b41ba 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -897,7 +897,11 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) zend_string *new_str = php_base64_decode( (unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); zval_ptr_dtor(&ent1->data); - ZVAL_STR(&ent1->data, new_str); + if (new_str) { + ZVAL_STR(&ent1->data, new_str); + } else { + ZVAL_EMPTY_STRING(&ent1->data); + } } /* Call __wakeup() method on the object.. */

« previous php.cvs (#93898) next »