summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-11-04 16:40:27 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2018-11-04 16:40:27 +0100
commit625f614cb13536d805985a2008840452c6c86a26 (patch)
treefd723311f3abf60c8eb8a4a6d47dc04f27565ea4
parente58388ea6d0b0246f61a9267930c1eba9c0f7f6b (diff)
downloadphp-git-625f614cb13536d805985a2008840452c6c86a26.tar.gz
Fix #76348: WSDL_CACHE_MEMORY causes Segmentation fault
“Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.”
-rw-r--r--NEWS3
-rw-r--r--ext/soap/php_sdl.c2
-rw-r--r--ext/soap/tests/bugs/bug76348.phpt15
-rw-r--r--ext/soap/tests/bugs/bug76348.wsdl87
4 files changed, 106 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 50683524e6..d13846840e 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ PHP NEWS
- Opcache:
. Fixed bug #77058 (Type inference in opcache causes side effects). (Nikita)
+- SOAP:
+ . Fixed bug #76348 (WSDL_CACHE_MEMORY causes Segmentation fault). (cmb)
+
08 Nov 2018, PHP 7.1.24
- Core:
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 695867d7e2..2485ef2fd8 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -2449,7 +2449,7 @@ static HashTable* make_persistent_sdl_function_headers(HashTable *headers, HashT
pheader->ns = strdup(pheader->ns);
}
- if (pheader->encode->details.sdl_type) {
+ if (pheader->encode && pheader->encode->details.sdl_type) {
if ((penc = zend_hash_str_find_ptr(ptr_map, (char*)&pheader->encode, sizeof(encodePtr))) == NULL) {
assert(0);
}
diff --git a/ext/soap/tests/bugs/bug76348.phpt b/ext/soap/tests/bugs/bug76348.phpt
new file mode 100644
index 0000000000..6b9e71bc3c
--- /dev/null
+++ b/ext/soap/tests/bugs/bug76348.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #76348 (WSDL_CACHE_MEMORY causes Segmentation fault)
+--SKIPIF--
+<?php
+if (!extension_loaded('soap')) die('skip soap extension not available');
+?>
+--FILE--
+<?php
+$client = new SoapClient(__DIR__ . DIRECTORY_SEPARATOR . 'bug76348.wsdl', [
+ 'cache_wsdl' => WSDL_CACHE_MEMORY,
+]);
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/soap/tests/bugs/bug76348.wsdl b/ext/soap/tests/bugs/bug76348.wsdl
new file mode 100644
index 0000000000..ebac20f894
--- /dev/null
+++ b/ext/soap/tests/bugs/bug76348.wsdl
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://example.x-road.ee/producer/"
+ xmlns:xrd="http://x-road.eu/xsd/xroad.xsd"
+ targetNamespace="http://example.x-road.ee/producer/">
+ <types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.x-road.ee/producer/">
+ <import namespace="http://x-road.ee/xsd/x-road.xsd" schemaLocation="http://x-road.ee/xsd/x-road.xsd"/>
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+ <element name="exampleOperation">
+ <complexType>
+ <sequence>
+ <element name="request" type="tns:exampleOperationRequest"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="exampleOperationResponse">
+ <complexType>
+ <sequence>
+ <element name="request" type="tns:exampleOperationRequest"/>
+ <element name="response" type="tns:exampleOperationResponse"/>
+ </sequence>
+ </complexType>
+ </element>
+ <complexType name="exampleOperationRequest">
+ <sequence>
+ <element name="name">
+ <complexType>
+ <sequence>
+ <element name="id" type="integer" minOccurs="0" nillable="true" />
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ <complexType name="exampleOperationResponse">
+ <sequence>
+ <element name="ok" type="boolean" />
+ </sequence>
+ </complexType>
+ </schema>
+ </types>
+
+
+ <message name="exampleOperationInputMessage">
+ <part name="body" element="tns:exampleOperation"/>
+ </message>
+ <message name="exampleOperationOutputMessage">
+ <part name="body" element="tns:exampleOperationResponse"/>
+ </message>
+
+ <message name="requestheader">
+ <part name="id" element="xrd:id"/>
+ </message>
+
+ <portType name="example_porttype">
+ <operation name="exampleOperation">
+ <input message="tns:exampleOperationInputMessage"/>
+ <output message="tns:exampleOperationOutputMessage"/>
+ </operation>
+ </portType>
+
+ <binding name="example_binding" type="tns:example_porttype">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="exampleOperation">
+ <soap:operation soapAction=""/>
+ <xrd:version>v1</xrd:version>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:header message="tns:requestheader" part="id" use="literal"/>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="example">
+ <port name="example_porttype" binding="tns:example_binding">
+ <soap:address location="http://PROXY/cgi-bin/consumer_proxy"/>
+ </port>
+ </service>
+
+</definitions>