]> granicus.if.org Git - php/commitdiff
- Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference)
authorFelipe Pena <felipe@php.net>
Tue, 15 Nov 2011 15:16:20 +0000 (15:16 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 15 Nov 2011 15:16:20 +0000 (15:16 +0000)
NEWS
ext/tidy/tests/bug54682.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/NEWS b/NEWS
index d84e39d3620fefb4b2bf085e11c53c963e449ef0..3a358f5f4c86d47f286014360d29df62e183c77e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,10 @@ PHP                                                                        NEWS
 
 - SOAP
   . Fixed bug #44686 (SOAP-ERROR: Parsing WSDL with references). (Dmitry)
+  
+- Tidy:
+  . Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference).
+    (Maksymilian Arciemowicz, Felipe)
 
 03 Nov 2011, PHP 5.3.9RC1
 
diff --git a/ext/tidy/tests/bug54682.phpt b/ext/tidy/tests/bug54682.phpt
new file mode 100644 (file)
index 0000000..99f40cf
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Tidy::diagnose() NULL pointer dereference
+--SKIPIF--
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
+--FILE--
+<?php
+
+$nx = new Tidy("*");
+$nx->diagnose();
+
+?>
+--EXPECTF--
+Warning: tidy::__construct(): Cannot Load '*' into memory in %s on line %d
index a89011db1f929bff3815ed03f5b88dd24b50696d..efd5028430fd8613c9ccb85e30c1547458aad9a3 100644 (file)
@@ -1288,7 +1288,7 @@ static PHP_FUNCTION(tidy_diagnose)
 {
        TIDY_FETCH_OBJECT;
 
-       if (tidyRunDiagnostics(obj->ptdoc->doc) >= 0) {
+       if (tidyStatus(obj->ptdoc->doc) != 0 && tidyRunDiagnostics(obj->ptdoc->doc) >= 0) {
                tidy_doc_update_properties(obj TSRMLS_CC);
                RETURN_TRUE;
        }