1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-26 10:03:34 +03:00

fuzz: Adjust for xmlNodeParseContent changes

xmlStringGetNodeList returns NULL again for empty strings.
This commit is contained in:
Nick Wellnhofer 2024-07-06 15:23:30 +02:00
parent 1e5375c1b4
commit de3221b179
2 changed files with 6 additions and 6 deletions

View File

@ -2496,7 +2496,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
list = xmlStringGetNodeList(
getDoc(0),
value = getStr(0));
oomReport = (value != NULL && list == NULL);
oomReport = (value != NULL && value[0] != 0 && list == NULL);
xmlFreeNodeList(list);
endOp();
break;
@ -2514,7 +2514,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
doc,
value,
xmlStrlen(value));
oomReport = (value != NULL && list == NULL);
oomReport = (value != NULL && value[0] != 0 && list == NULL);
xmlFreeNodeList(list);
endOp();
break;

8
tree.c
View File

@ -1480,8 +1480,8 @@ xmlNodeParseContent(xmlNodePtr node, const xmlChar *content, int len) {
*
* See xmlStringGetNodeList.
*
* Returns a pointer to the first child or NULL if a memory
* allocation failed.
* Returns a pointer to the first child or NULL if the value if empty
* or a memory allocation failed.
*/
xmlNodePtr
xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
@ -1507,8 +1507,8 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
* undeclared entities will be ignored silently with unspecified
* results.
*
* Returns a pointer to the first child or NULL if a memory
* allocation failed.
* Returns a pointer to the first child or NULL if the value if empty
* or a memory allocation failed.
*/
xmlNodePtr
xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {