aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libxml2-bug-755857.patch
blob: 3f1efd380671c4c008a2c2abbde8459123e71c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From cf77e60515045bdd66f2c59c69a06e603b470eae Mon Sep 17 00:00:00 2001
From: Gaurav Gupta <g.gupta@samsung.com>
Date: Wed, 30 Sep 2015 14:46:29 +0200
Subject: [PATCH] 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
---
 parser.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/parser.c b/parser.c
index f1724a9..a65e4cc 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;
-- 
2.6.3