diff options
| author | Christian Stocker <chregu@php.net> | 2004-01-19 20:54:40 +0000 |
|---|---|---|
| committer | Christian Stocker <chregu@php.net> | 2004-01-19 20:54:40 +0000 |
| commit | 00af01bb94e2497a39f9cfaa22e7143bd279d8b9 (patch) | |
| tree | 84ba8297a6b6824571ed6ec296d3630e86bf611f | |
| parent | dde4c166c938672bf171c67f7784aece5fdf3c39 (diff) | |
| download | php-git-00af01bb94e2497a39f9cfaa22e7143bd279d8b9.tar.gz | |
fixes segfault, if file doesn't exist (by Pierre-Alain)
| -rw-r--r-- | ext/dom/document.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index 49eb34d6a3..85f9ff0030 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1720,12 +1720,21 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) 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) { |
