Skip to content

Commit

Permalink
Fix null pointer dereferences in case of allocation failure
Browse files Browse the repository at this point in the history
Closes GH-12506.
  • Loading branch information
icy17 authored and nielsdos committed Oct 24, 2023
1 parent aa45df4 commit 900f0ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NEWS
Expand Up @@ -8,6 +8,7 @@ PHP NEWS

- DOM:
. Fix registerNodeClass with abstract class crashing. (nielsdos)
. Add missing NULL pointer error check. (icy17)

- Fiber:
. Fixed bug GH-11121 (ReflectionFiber segfault). (danog, trowski, bwoebi)
Expand Down Expand Up @@ -39,6 +40,12 @@ PHP NEWS
. Fixed bug #75708 (getimagesize with "&$imageinfo" fails on StreamWrappers).
(Jakub Zelenka)

- XMLReader:
. Add missing NULL pointer error check. (icy17)

- XMLWriter:
. Add missing NULL pointer error check. (icy17)

- XSL:
. Add missing module dependency. (nielsdos)

Expand Down
3 changes: 3 additions & 0 deletions ext/dom/document.c
Expand Up @@ -1148,6 +1148,9 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
int isFileUri = 0;

uri = xmlCreateURI();
if (uri == NULL) {
return NULL;
}
escsource = xmlURIEscapeStr((xmlChar *) source, (xmlChar *) ":");
xmlParseURIReference(uri, (char *) escsource);
xmlFree(escsource);
Expand Down
3 changes: 3 additions & 0 deletions ext/xmlreader/php_xmlreader.c
Expand Up @@ -211,6 +211,9 @@ char *_xmlreader_get_valid_file_path(char *source, char *resolved_path, int reso
int isFileUri = 0;

uri = xmlCreateURI();
if (uri == NULL) {
return NULL;
}
escsource = xmlURIEscapeStr((xmlChar *)source, (xmlChar *)":");
xmlParseURIReference(uri, (const char *)escsource);
xmlFree(escsource);
Expand Down
3 changes: 3 additions & 0 deletions ext/xmlwriter/php_xmlwriter.c
Expand Up @@ -110,6 +110,9 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
int isFileUri = 0;

uri = xmlCreateURI();
if (uri == NULL) {
return NULL;
}
escsource = xmlURIEscapeStr((xmlChar *)source, (xmlChar *) ":");
xmlParseURIReference(uri, (char *)escsource);
xmlFree(escsource);
Expand Down

0 comments on commit 900f0ca

Please sign in to comment.