kloczek / rpms / libxml2

Forked from rpms/libxml2 6 years ago
Clone

Blame libxml2-2.9.5-Report-undefined-XPath-variable-error-message.patch

09a4a28
From 3157cf4e53c03bc3da604472c015c63141907db8 Mon Sep 17 00:00:00 2001
09a4a28
From: Nick Wellnhofer <wellnhofer@aevum.de>
09a4a28
Date: Wed, 20 Sep 2017 16:13:29 +0200
09a4a28
Subject: [PATCH] Report undefined XPath variable error message
09a4a28
MIME-Version: 1.0
09a4a28
Content-Type: text/plain; charset=UTF-8
09a4a28
Content-Transfer-Encoding: 8bit
09a4a28
09a4a28
Commit c851970 removed a redundant error message if XPath evaluation
09a4a28
failed. This uncovered a case where an undefined XPath variable error
09a4a28
wasn't reported correctly.
09a4a28
09a4a28
Thanks to Petr Pisar for the report.
09a4a28
09a4a28
Fixes bug 787941.
09a4a28
09a4a28
Signed-off-by: Petr Písař <ppisar@redhat.com>
09a4a28
---
09a4a28
 xpath.c | 12 ++++--------
09a4a28
 1 file changed, 4 insertions(+), 8 deletions(-)
09a4a28
09a4a28
diff --git a/xpath.c b/xpath.c
09a4a28
index 2c1b2681..94815075 100644
09a4a28
--- a/xpath.c
09a4a28
+++ b/xpath.c
09a4a28
@@ -13531,10 +13531,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
09a4a28
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
09a4a28
                 if (op->value5 == NULL) {
09a4a28
 		    val = xmlXPathVariableLookup(ctxt->context, op->value4);
09a4a28
-		    if (val == NULL) {
09a4a28
-			ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
09a4a28
-			return(0);
09a4a28
-		    }
09a4a28
+		    if (val == NULL)
09a4a28
+			XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
09a4a28
                     valuePush(ctxt, val);
09a4a28
 		} else {
09a4a28
                     const xmlChar *URI;
09a4a28
@@ -13549,10 +13547,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
09a4a28
                     }
09a4a28
 		    val = xmlXPathVariableLookupNS(ctxt->context,
09a4a28
                                                        op->value4, URI);
09a4a28
-		    if (val == NULL) {
09a4a28
-			ctxt->error = XPATH_UNDEF_VARIABLE_ERROR;
09a4a28
-			return(0);
09a4a28
-		    }
09a4a28
+		    if (val == NULL)
09a4a28
+			XP_ERROR0(XPATH_UNDEF_VARIABLE_ERROR);
09a4a28
                     valuePush(ctxt, val);
09a4a28
                 }
09a4a28
                 return (total);
09a4a28
-- 
09a4a28
2.13.5
09a4a28