File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -2461,11 +2461,14 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
24612461 first = getNode (0 );
24622462 second = getNode (1 );
24632463 argsOk =
2464- (first != NULL && first -> type == XML_TEXT_NODE &&
2465- second != NULL && second -> type == XML_TEXT_NODE &&
2466- first != second &&
2467- first -> name == second -> name );
2468- if (argsOk ) {
2464+ first == NULL ?
2465+ second != NULL :
2466+ second == NULL ||
2467+ (first -> type == XML_TEXT_NODE &&
2468+ second -> type == XML_TEXT_NODE &&
2469+ first != second &&
2470+ first -> name == second -> name );
2471+ if (argsOk && second != NULL ) {
24692472 if (second -> parent != NULL )
24702473 parent = second -> parent ;
24712474 else
@@ -2474,7 +2477,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
24742477 }
24752478 res = xmlTextMerge (first , second );
24762479 oomReport = (argsOk && res == NULL );
2477- if (res != NULL ) {
2480+ if (res != NULL && first != NULL ) {
24782481 removeNode (second );
24792482 dropNode (parent );
24802483 checkContent (first );
Original file line number Diff line number Diff line change @@ -5790,15 +5790,21 @@ xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) {
57905790 * @first: the first text node
57915791 * @second: the second text node being merged
57925792 *
5793- * Merge the second text node into the first. The second node is
5794- * unlinked and freed.
5793+ * Merge the second text node into the first. If @first is NULL,
5794+ * @second is returned. Otherwise, the second node is unlinked and
5795+ * freed.
57955796 *
57965797 * Returns the first text node augmented or NULL in case of error.
57975798 */
57985799xmlNodePtr
57995800xmlTextMerge (xmlNodePtr first , xmlNodePtr second ) {
5800- if ((first == NULL ) || (first -> type != XML_TEXT_NODE ) ||
5801- (second == NULL ) || (second -> type != XML_TEXT_NODE ) ||
5801+ if (first == NULL )
5802+ return (second );
5803+ if (second == NULL )
5804+ return (first );
5805+
5806+ if ((first -> type != XML_TEXT_NODE ) ||
5807+ (second -> type != XML_TEXT_NODE ) ||
58025808 (first == second ) ||
58035809 (first -> name != second -> name ))
58045810 return (NULL );
You can’t perform that action at this time.
0 commit comments