Fix reporting error about undefined XPath variables

This commit is contained in:
Petr Písař 2017-09-22 12:26:42 +02:00
parent 72e4478789
commit 09a4a286a9
2 changed files with 62 additions and 1 deletions

View File

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

View File

@ -3,7 +3,7 @@
Summary: Library providing XML and HTML support Summary: Library providing XML and HTML support
Name: libxml2 Name: libxml2
Version: 2.9.5 Version: 2.9.5
Release: 1%{?dist}%{?extra_release} Release: 2%{?dist}%{?extra_release}
License: MIT License: MIT
Group: Development/Libraries Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
@ -21,6 +21,9 @@ Patch1: libxml2-2.9.0-do-not-check-crc.patch
# In python3.6 _PyVerify_fd is no more # In python3.6 _PyVerify_fd is no more
# http://bugs.python.org/issue23524 # http://bugs.python.org/issue23524
Patch2: libxml2-2.9.4-remove-pyverify_fd.patch Patch2: libxml2-2.9.4-remove-pyverify_fd.patch
# Fix reporting error about undefined XPath variables, bug #1493613,
# Gnome bug #787941, fixed in upstream after 2.9.5
Patch3: libxml2-2.9.5-Report-undefined-XPath-variable-error-message.patch
%description %description
This library allows to manipulate XML files. It includes support This library allows to manipulate XML files. It includes support
@ -107,6 +110,7 @@ at parse time or later once the document has been modified.
%if 0%{?fedora} > 25 %if 0%{?fedora} > 25
%patch2 -p1 %patch2 -p1
%endif %endif
%patch3 -p1
mkdir py3doc mkdir py3doc
cp doc/*.py py3doc cp doc/*.py py3doc
@ -218,6 +222,9 @@ rm -fr %{buildroot}
%changelog %changelog
* Fri Sep 22 2017 Petr Pisar <ppisar@redhat.com> - 2.9.5-2
- Fix reporting error about undefined XPath variables (bug #1493613)
* Mon Sep 4 2017 Daniel Veillard <veillard@redhat.com> - 2.9.5-1 * Mon Sep 4 2017 Daniel Veillard <veillard@redhat.com> - 2.9.5-1
- update to 2.9.5 - update to 2.9.5