aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav Gupta <g.gupta@samsung.com>2015-09-30 14:46:29 +0200
committerDaniel Veillard <veillard@redhat.com>2015-09-30 14:46:29 +0200
commitcf77e60515045bdd66f2c59c69a06e603b470eae (patch)
tree31b5fecab0fc39095fb20b1d5aa2d0ee8ec229e8
parent4a5d80aded1da94cd55294e7207109712201b75b (diff)
downloadandroid_external_libxml2-cf77e60515045bdd66f2c59c69a06e603b470eae.tar.gz
android_external_libxml2-cf77e60515045bdd66f2c59c69a06e603b470eae.tar.bz2
android_external_libxml2-cf77e60515045bdd66f2c59c69a06e603b470eae.zip
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
-rw-r--r--parser.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/parser.c b/parser.c
index f1724a9a..a65e4cc8 100644
--- a/parser.c
+++ b/parser.c
@@ -13367,7 +13367,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
/*
* 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->cur - ctxt->input->base);
}
@@ -13379,9 +13379,11 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
if (sax != NULL)
ctxt->sax = oldsax;
- oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
- oldctxt->node_seq.length = ctxt->node_seq.length;
- oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
+ if (oldctxt != NULL) {
+ oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
+ oldctxt->node_seq.length = ctxt->node_seq.length;
+ oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
+ }
ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL;