mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
fixes segfault, if file doesn't exist (by Pierre-Alain)
This commit is contained in:
parent
dde4c166c9
commit
00af01bb94
1 changed files with 9 additions and 0 deletions
|
@ -1720,12 +1720,21 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!source_len) {
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == DOM_LOAD_FILE) {
|
if (mode == DOM_LOAD_FILE) {
|
||||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||||
} else {
|
} else {
|
||||||
source_len = xmlStrlen(source);
|
source_len = xmlStrlen(source);
|
||||||
ctxt = htmlCreateMemoryParserCtxt(source, source_len);
|
ctxt = htmlCreateMemoryParserCtxt(source, source_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ctxt) {
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ctxt->vctxt.error = php_libxml_ctx_error;
|
ctxt->vctxt.error = php_libxml_ctx_error;
|
||||||
ctxt->vctxt.warning = php_libxml_ctx_warning;
|
ctxt->vctxt.warning = php_libxml_ctx_warning;
|
||||||
if (ctxt->sax != NULL) {
|
if (ctxt->sax != NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue