From fd61666d96277779b1b85f59a0651cb42eed3420 Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Sat, 7 Nov 2015 10:35:45 +0100 Subject: [PATCH] Fix bug #70875 Segmentation fault if wsdl has no targetNamespace attribute --- NEWS | 4 + ext/soap/php_sdl.c | 2 +- ext/soap/tests/bug70875.phpt | 50 +++++++++++ ext/soap/tests/bug70875.wsdl | 156 +++++++++++++++++++++++++++++++++++ 4 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 ext/soap/tests/bug70875.phpt create mode 100644 ext/soap/tests/bug70875.wsdl diff --git a/NEWS b/NEWS index 1d0ed5ea88..6164dd59a4 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,10 @@ PHP NEWS . Fixed bug #69757 (Segmentation fault on nextRowset). (miracle at rpz dot name) +- SOAP: + . Fixed bug #70875 (Segmentation fault if wsdl has no targetNamespace + attribute). (Matteo) + - SPL: . Fixed bug #70852 Segfault getting NULL offset of an ArrayObject. (Reeze Xia) diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 355762123c..4ba1119d35 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -111,7 +111,7 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type) { encodePtr enc = NULL; char *nscat; - int ns_len = strlen(ns); + int ns_len = ns ? strlen(ns) : 0; int type_len = strlen(type); int len = ns_len + type_len + 1; diff --git a/ext/soap/tests/bug70875.phpt b/ext/soap/tests/bug70875.phpt new file mode 100644 index 0000000000..6f10462bfc --- /dev/null +++ b/ext/soap/tests/bug70875.phpt @@ -0,0 +1,50 @@ +--TEST-- +SOAP Bug #70875 - Segmentation fault if wsdl has no targetNamespace attribute +--SKIPIF-- + +--INI-- +soap.wsdl_cache_enabled=0 +--FILE-- + 1, + 'classmap' => [ + 'TestService' => 'TestService', + 'TestServiceRQ' => 'TestServiceRQ', + 'RqHeader' => 'RqHeader', + ], +]); + + +class TestService +{ + public $TestServiceRQ; +} + +class TestServiceRQ +{ + public $RqHeader; +} + +class RqHeader +{ +} + +$r = new TestService(); +$r->TestServiceRQ = new TestServiceRQ(); +$r->TestServiceRQ->RqHeader = new RqHeader(); + +$c->testService($r); + +?> +--EXPECT-- +no SIGSEGV diff --git a/ext/soap/tests/bug70875.wsdl b/ext/soap/tests/bug70875.wsdl new file mode 100644 index 0000000000..f874b9ae6c --- /dev/null +++ b/ext/soap/tests/bug70875.wsdl @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.40.0