summaryrefslogtreecommitdiff
path: root/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch')
-rw-r--r--debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch b/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
new file mode 100644
index 0000000..d065088
--- /dev/null
+++ b/debian/patches/0012-Fail-parsing-early-on-if-encoding-conversion-failed.patch
@@ -0,0 +1,31 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 29 Jun 2015 16:10:26 +0800
+Subject: Fail parsing early on if encoding conversion failed
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=751631
+
+If we fail conversing the current input stream while
+processing the encoding declaration of the XMLDecl
+then it's safer to just abort there and not try to
+report further errors.
+---
+ parser.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/parser.c b/parser.c
+index a3a9568..0edd53b 100644
+--- a/parser.c
++++ b/parser.c
+@@ -10471,7 +10471,11 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
+
+ handler = xmlFindCharEncodingHandler((const char *) encoding);
+ if (handler != NULL) {
+- xmlSwitchToEncoding(ctxt, handler);
++ if (xmlSwitchToEncoding(ctxt, handler) < 0) {
++ /* failed to convert */
++ ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
++ return(NULL);
++ }
+ } else {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
+ "Unsupported encoding %s\n", encoding);