mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
If get_iterator() fails, we should not destroy the object. Also changes the check to a NULL check to be more defensive, and to match the VM. Closes GH-16441.
This commit is contained in:
parent
ec8a24f746
commit
d613c0ed30
4
NEWS
4
NEWS
@ -55,6 +55,10 @@ PHP NEWS
|
||||
. Fixed bug GH-16290 (overflow on cookie_lifetime ini value).
|
||||
(David Carlier)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug GH-16429 (Segmentation fault access null pointer in SoapClient).
|
||||
(nielsdos)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug with overflow socket_recvfrom $length argument. (David Carlier)
|
||||
|
||||
|
@ -2210,8 +2210,8 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
|
||||
|
||||
iter = ce->get_iterator(ce, data, 0);
|
||||
|
||||
if (EG(exception)) {
|
||||
goto iterator_done;
|
||||
if (!iter) {
|
||||
goto iterator_failed_to_get;
|
||||
}
|
||||
|
||||
if (iter->funcs->rewind) {
|
||||
@ -2251,6 +2251,7 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
|
||||
}
|
||||
iterator_done:
|
||||
OBJ_RELEASE(&iter->std);
|
||||
iterator_failed_to_get:
|
||||
if (EG(exception)) {
|
||||
zval_ptr_dtor(&array_copy);
|
||||
ZVAL_UNDEF(&array_copy);
|
||||
|
22
ext/soap/tests/bugs/gh16429.phpt
Normal file
22
ext/soap/tests/bugs/gh16429.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
GH-16429 (Segmentation fault (access null pointer) in SoapClient)
|
||||
--EXTENSIONS--
|
||||
soap
|
||||
--FILE--
|
||||
<?php
|
||||
function gen() {
|
||||
var_dump(str_repeat("x", yield));
|
||||
}
|
||||
$gen = gen();
|
||||
$gen->send(10);
|
||||
$fusion = $gen;
|
||||
$client = new SoapClient(__DIR__."/../interop/Round2/GroupB/round2_groupB.wsdl",array("trace"=>1,"exceptions"=>0));
|
||||
try {
|
||||
$client->echo2DStringArray($fusion);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "xxxxxxxxxx"
|
||||
Cannot traverse an already closed generator
|
Loading…
Reference in New Issue
Block a user