chregu          Mon Jan 19 15:54:41 2004 EDT

  Modified files:              
    /php-src/ext/dom    document.c 
  Log:
  fixes segfault, if file doesn't exist (by Pierre-Alain)
  
http://cvs.php.net/diff.php/php-src/ext/dom/document.c?r1=1.44&r2=1.45&ty=u
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.44 php-src/ext/dom/document.c:1.45
--- php-src/ext/dom/document.c:1.44     Sun Jan 18 07:56:23 2004
+++ php-src/ext/dom/document.c  Mon Jan 19 15:54:40 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: document.c,v 1.44 2004/01/18 12:56:23 chregu Exp $ */
+/* $Id: document.c,v 1.45 2004/01/19 20:54:40 chregu Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1720,12 +1720,21 @@
                return;
        }
 
+       if (!source_len) {
+               RETURN_FALSE;
+       }
+
        if (mode == DOM_LOAD_FILE) {
                ctxt = htmlCreateFileParserCtxt(source, NULL);
        } else {
                source_len = xmlStrlen(source);
                ctxt = htmlCreateMemoryParserCtxt(source, source_len);
        }
+
+       if (!ctxt) {
+               RETURN_FALSE;
+       }
+
        ctxt->vctxt.error = php_libxml_ctx_error;
        ctxt->vctxt.warning = php_libxml_ctx_warning;
        if (ctxt->sax != NULL) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to