Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed 95e99c5

Modified Files:
dom.c
[fix] segfault while appending a entity reference to a document
(reported by Petr Pajas)

  • Participants
  • Parent commits 27ce886

Comments (0)

Files changed (1)

         xmlSetTreeDoc(return_node, doc);
     }
 
-    if ( doc != NULL && return_node != NULL ) {
+    if ( doc != NULL 
+         && return_node != NULL
+         && return_node->type != XML_ENTITY_REF_NODE ) {
         xmlReconciliateNs(doc, return_node);     
     }
 
         newChild->parent= self;
     }
  
-    xmlReconciliateNs(self->doc, newChild);     
+    if ( newChild->type != XML_ENTITY_REF_NODE ) {
+        xmlReconciliateNs(self->doc, newChild);     
+    }
 
     return newChild;
 }
     }
     
     domAddNodeToList(newChild, refChild->prev, refChild);
-    xmlReconciliateNs(self->doc, newChild);     
+    if ( newChild->type != XML_ENTITY_REF_NODE ) {
+        xmlReconciliateNs(self->doc, newChild);     
+    }
 
     return newChild;
 }
     }
 
     domAddNodeToList(newChild, refChild, refChild->next);
-    xmlReconciliateNs(self->doc, newChild);     
+    if ( newChild->type != XML_ENTITY_REF_NODE ) {
+        xmlReconciliateNs(self->doc, newChild);     
+    }
 
     return newChild;
 }
         domAddNodeToList( newNode, prev,  next );
     }
 
-    xmlReconciliateNs(newNode->doc, newNode); 
+    if ( newNode->type != XML_ENTITY_REF_NODE ) {
+        xmlReconciliateNs(newNode->doc, newNode); 
+    }
 
     return oldNode;
 }