com php-src: Fixed bug #70535 (XSLT: free(): invalid pointer): NEWS ext/libxml/php_libxml.h ext/xsl/tests/bug70535 .phpt
| From: | Xinchen Hui | Date: | Sun, 20 Sep 2015 16:30:50 +0000 |
| Subject: | com php-src: Fixed bug #70535 (XSLT: free(): invalid pointer): NEWS ext/libxml/php_libxml.h ext/xsl/tests/bug70535 .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89091@lists.php.net to get a copy of this message | ||
Commit: 3fc5f5cdb5d22461241b38d0e8cba8ae89b2db71
Author: Xinchen Hui <laruence@gmail.com> Sun, 20 Sep 2015 09:30:50 -0700
Parents: 6a813634052710f3f4bf6e2e03ca1b6c7be3bcee
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3fc5f5cdb5d22461241b38d0e8cba8ae89b2db71
Log:
Fixed bug #70535 (XSLT: free(): invalid pointer)
Bugs:
https://bugs.php.net/70535
Changed paths:
M NEWS
M ext/libxml/php_libxml.h
A ext/xsl/tests/bug70535.phpt
Diff:
diff --git a/NEWS b/NEWS
index 88cbaaa..b62d856 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ PHP NEWS
- XMLRPC
. Fixed bug #70526 (xmlrpc_set_type returns false on success). (Laruence)
+- XSL:
+ . Fixed bug #70535 (XSLT: free(): invalid pointer). (Laruence)
+
17 Sep 2015, PHP 7.0.0 RC 3
- Core:
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index 6dc9daa..3d61b6b 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -86,7 +86,7 @@ typedef struct _php_libxml_node_object {
static inline php_libxml_node_object *php_libxml_node_fetch_object(zend_object *obj) {
- return (php_libxml_node_object *)((char*)(obj) - XtOffsetOf(php_libxml_node_object, std));
+ return (php_libxml_node_object *)((char*)(obj) - obj->handlers->offset);
}
#define Z_LIBXML_NODE_P(zv) php_libxml_node_fetch_object(Z_OBJ_P((zv)))
diff --git a/ext/xsl/tests/bug70535.phpt b/ext/xsl/tests/bug70535.phpt
new file mode 100644
index 0000000..26b4d3c
--- /dev/null
+++ b/ext/xsl/tests/bug70535.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #70535 (XSLT: free(): invalid pointer)
+--SKIPIF--
+<?php
+if (!extension_loaded('xsl')) die("skip Extension XSL is required\n");
+if (!extension_loaded("simplexml")) print "skip simplexml extension is not
loaded";
+?>
+--FILE--
+<?php
+
+$xmlInput = simplexml_load_string('<root></root>');
+$xslInput = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template
match="root"><xsl:text>success</xsl:text></xsl:template></xsl:stylesheet>';
+
+$xsl = new \DomDocument();
+$xsl->loadXML($xslInput);
+$xslt = new \XsltProcessor();
+$xslt->importStylesheet($xsl);
+$xmloutput = $xslt->transformToXml($xmlInput);
+?>
+okey
+--EXPECT--
+okey