com php-src: Fix #78173: XML-RPC mutates immutable objects during encoding: NEWS ext/xmlrpc/xmlrpc-epi-php.c

From: Date: Tue, 18 Jun 2019 15:08:11 +0000
Subject: com php-src: Fix #78173: XML-RPC mutates immutable objects during encoding: NEWS ext/xmlrpc/xmlrpc-epi-php.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106870@lists.php.net to get a copy of this message
Commit: d54220bc795a7025a162c61128c98a7af14087a4 Author: Asher Baker <asher.baker@tripleplay.tv> Tue, 18 Jun 2019 15:05:38 +0100 Committer: Christoph M. Becker <cmbecker69@gmx.de> Tue, 18 Jun 2019 17:08:11 +0200 Parents: e59b986fa7cb4da0a59df09aa4179095b9811529 Branches: PHP-7.2 PHP-7.3 PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d54220bc795a7025a162c61128c98a7af14087a4 Log: Fix #78173: XML-RPC mutates immutable objects during encoding With opcache.protect_memory=1 enabled, the XML-RPC extension causes a segfault on PHP 7.2 as it is modifying the recursion counter of objects it touches, without first checking if they are immutable or not. This doesn't affect 7.3+ Bugs: https://bugs.php.net/78173 Changed paths: M NEWS M ext/xmlrpc/xmlrpc-epi-php.c Diff: diff --git a/NEWS b/NEWS index d02a6ce..92de1e4 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2019, PHP 7.2.21 +- XMLRPC: + . Fixed #78173 (XML-RPC mutates immutable objects during encoding).. (Asher + Baker) 27 Jun 2019, PHP 7.2.20 diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 36fbff1..69d9658 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -556,7 +556,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep XMLRPC_VECTOR_TYPE vtype; ht = HASH_OF(&val); - if (ht && ht->u.v.nApplyCount > 1) { + if (ht && ZEND_HASH_APPLY_PROTECTION(ht) && ht->u.v.nApplyCount > 1) { zend_throw_error(NULL, "XML-RPC doesn't support circular references"); return NULL; } @@ -570,7 +570,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(val_arr), num_index, my_key, pIter) { ZVAL_DEREF(pIter); ht = HASH_OF(pIter); - if (ht) { + if (ht && ZEND_HASH_APPLY_PROTECTION(ht)) { ht->u.v.nApplyCount++; } if (my_key == NULL) { @@ -587,7 +587,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep } else { XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(ZSTR_VAL(my_key), pIter, depth++)); } - if (ht) { + if (ht && ZEND_HASH_APPLY_PROTECTION(ht)) { ht->u.v.nApplyCount--; } } ZEND_HASH_FOREACH_END();

« previous php.cvs (#106870) next »