~ubuntu-branches/ubuntu/wily/libxml2/wily-proposed

« back to all changes in this revision

Viewing changes to debian/patches/0006-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-07-11 09:31:50 UTC
  • mfrom: (43.2.4 sid)
  • Revision ID: package-import@ubuntu.com-20130711093150-t3vcnrpfqepqt0mp
Tags: 2.9.1+dfsg1-2ubuntu1
* Merged from Debian unstable. Remaining changes:
  - Fix python multi-arch includes issues. 
  - Allow the package to cross-build.
  - Set PYTHON_LIBS for cross builds.
  - Remove explicit build dependency on binutils.
  - Configure the udeb --without-python.
* Dropped patches:
  - CVE-2013-0338.patch: upstream
  - CVE-2013-1969.patch: upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Daniel Veillard <veillard@redhat.com>
 
2
Date: Wed, 22 May 2013 20:56:45 +0000
 
3
Subject: Fix a parsing bug on non-ascii element and CR/LF usage
 
4
 
 
5
https://bugzilla.gnome.org/show_bug.cgi?id=698550
 
6
 
 
7
Somehow the behaviour of the internal parser routine changed
 
8
slightly when encountering CR/LF, which led to a bug when
 
9
parsing document with non-ascii Names
 
10
---
 
11
 parser.c |    6 +++++-
 
12
 1 file changed, 5 insertions(+), 1 deletion(-)
 
13
 
 
14
diff --git a/parser.c b/parser.c
 
15
index b9df6d8..dd00399 100644
 
16
--- a/parser.c
 
17
+++ b/parser.c
 
18
@@ -3404,6 +3404,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
 
19
     int len = 0, l;
 
20
     int c;
 
21
     int count = 0;
 
22
+    const xmlChar *end; /* needed because CUR_CHAR() can move cur on \r\n */
 
23
 
 
24
 #ifdef DEBUG
 
25
     nbParseNCNameComplex++;
 
26
@@ -3413,6 +3414,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
 
27
      * Handler for more complex cases
 
28
      */
 
29
     GROW;
 
30
+    end = ctxt->input->cur;
 
31
     c = CUR_CHAR(l);
 
32
     if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
 
33
        (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) {
 
34
@@ -3434,12 +3436,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
 
35
        }
 
36
        len += l;
 
37
        NEXTL(l);
 
38
+       end = ctxt->input->cur;
 
39
        c = CUR_CHAR(l);
 
40
        if (c == 0) {
 
41
            count = 0;
 
42
            GROW;
 
43
             if (ctxt->instate == XML_PARSER_EOF)
 
44
                 return(NULL);
 
45
+           end = ctxt->input->cur;
 
46
            c = CUR_CHAR(l);
 
47
        }
 
48
     }
 
49
@@ -3448,7 +3452,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
 
50
         xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
 
51
         return(NULL);
 
52
     }
 
53
-    return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
 
54
+    return(xmlDictLookup(ctxt->dict, end - len, len));
 
55
 }
 
56
 
 
57
 /**