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

Add missing Null check in xmlParseExternalEntityPrivate

For https://bugzilla.gnome.org/show_bug.cgi?id=755857

a case where we check for NULL but not everywhere
This commit is contained in:
Gaurav Gupta
2015-09-30 14:46:29 +02:00
committed by Daniel Veillard
parent 4a5d80aded
commit cf77e60515

View File

@@ -13367,7 +13367,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
/* /*
* Also record the size of the entity parsed * Also record the size of the entity parsed
*/ */
if (ctxt->input != NULL) { if (ctxt->input != NULL && oldctxt != NULL) {
oldctxt->sizeentities += ctxt->input->consumed; oldctxt->sizeentities += ctxt->input->consumed;
oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base); oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base);
} }
@@ -13379,9 +13379,11 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
if (sax != NULL) if (sax != NULL)
ctxt->sax = oldsax; ctxt->sax = oldsax;
oldctxt->node_seq.maximum = ctxt->node_seq.maximum; if (oldctxt != NULL) {
oldctxt->node_seq.length = ctxt->node_seq.length; oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
oldctxt->node_seq.buffer = ctxt->node_seq.buffer; oldctxt->node_seq.length = ctxt->node_seq.length;
oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
}
ctxt->node_seq.maximum = 0; ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0; ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL; ctxt->node_seq.buffer = NULL;