/[packages]/updates/8/expat/current/SOURCES/CVE-2022-25236-6.patch
ViewVC logotype

Annotation of /updates/8/expat/current/SOURCES/CVE-2022-25236-6.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1790357 - (hide annotations) (download)
Fri Mar 11 09:19:06 2022 UTC (2 years, 1 month ago) by ns80
File size: 4435 byte(s)
- add patches from Ubuntu to fix regressions introduced by security fixes (mga#30145)

1 ns80 1790357 From 2ba6c76fca21397959145e18c5ef376201209020 Mon Sep 17 00:00:00 2001
2     From: Sebastian Pipping <sebastian@pipping.org>
3     Date: Sun, 27 Feb 2022 16:58:08 +0100
4     Subject: [PATCH] lib: Relax fix to CVE-2022-25236 with regard to RFC 3986 URI
5     characters
6    
7     ---
8     expat/lib/xmlparse.c | 139 ++++++++++++++++++++++++++++++++++++++++---
9     1 file changed, 131 insertions(+), 8 deletions(-)
10    
11     --- a/lib/xmlparse.c
12     +++ b/lib/xmlparse.c
13     @@ -3512,6 +3512,117 @@ storeAtts(XML_Parser parser, const ENCOD
14     return XML_ERROR_NONE;
15     }
16    
17     +static XML_Bool
18     +is_rfc3986_uri_char(XML_Char candidate) {
19     + // For the RFC 3986 ANBF grammar see
20     + // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
21     +
22     + switch (candidate) {
23     + // From rule "ALPHA" (uppercase half)
24     + case 'A':
25     + case 'B':
26     + case 'C':
27     + case 'D':
28     + case 'E':
29     + case 'F':
30     + case 'G':
31     + case 'H':
32     + case 'I':
33     + case 'J':
34     + case 'K':
35     + case 'L':
36     + case 'M':
37     + case 'N':
38     + case 'O':
39     + case 'P':
40     + case 'Q':
41     + case 'R':
42     + case 'S':
43     + case 'T':
44     + case 'U':
45     + case 'V':
46     + case 'W':
47     + case 'X':
48     + case 'Y':
49     + case 'Z':
50     +
51     + // From rule "ALPHA" (lowercase half)
52     + case 'a':
53     + case 'b':
54     + case 'c':
55     + case 'd':
56     + case 'e':
57     + case 'f':
58     + case 'g':
59     + case 'h':
60     + case 'i':
61     + case 'j':
62     + case 'k':
63     + case 'l':
64     + case 'm':
65     + case 'n':
66     + case 'o':
67     + case 'p':
68     + case 'q':
69     + case 'r':
70     + case 's':
71     + case 't':
72     + case 'u':
73     + case 'v':
74     + case 'w':
75     + case 'x':
76     + case 'y':
77     + case 'z':
78     +
79     + // From rule "DIGIT"
80     + case '0':
81     + case '1':
82     + case '2':
83     + case '3':
84     + case '4':
85     + case '5':
86     + case '6':
87     + case '7':
88     + case '8':
89     + case '9':
90     +
91     + // From rule "pct-encoded"
92     + case '%':
93     +
94     + // From rule "unreserved"
95     + case '-':
96     + case '.':
97     + case '_':
98     + case '~':
99     +
100     + // From rule "gen-delims"
101     + case ':':
102     + case '/':
103     + case '?':
104     + case '#':
105     + case '[':
106     + case ']':
107     + case '@':
108     +
109     + // From rule "sub-delims"
110     + case '!':
111     + case '$':
112     + case '&':
113     + case '\'':
114     + case '(':
115     + case ')':
116     + case '*':
117     + case '+':
118     + case ',':
119     + case ';':
120     + case '=':
121     + return XML_TRUE;
122     +
123     + default:
124     + return XML_FALSE;
125     + }
126     +}
127     +
128     /* addBinding() overwrites the value of prefix->binding without checking.
129     Therefore one must keep track of the old value outside of addBinding().
130     */
131     @@ -3568,14 +3679,26 @@ addBinding(XML_Parser parser, PREFIX *pr
132     && (len > xmlnsLen || uri[len] != xmlnsNamespace[len]))
133     isXMLNS = XML_FALSE;
134    
135     - // NOTE: While Expat does not validate namespace URIs against RFC 3986,
136     - // we have to at least make sure that the XML processor on top of
137     - // Expat (that is splitting tag names by namespace separator into
138     - // 2- or 3-tuples (uri-local or uri-local-prefix)) cannot be confused
139     - // by an attacker putting additional namespace separator characters
140     - // into namespace declarations. That would be ambiguous and not to
141     - // be expected.
142     - if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator)) {
143     + // NOTE: While Expat does not validate namespace URIs against RFC 3986
144     + // today (and is not REQUIRED to do so with regard to the XML 1.0
145     + // namespaces specification) we have to at least make sure, that
146     + // the application on top of Expat (that is likely splitting expanded
147     + // element names ("qualified names") of form
148     + // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
149     + // in its element handler code) cannot be confused by an attacker
150     + // putting additional namespace separator characters into namespace
151     + // declarations. That would be ambiguous and not to be expected.
152     + //
153     + // While the HTML API docs of function XML_ParserCreateNS have been
154     + // advising against use of a namespace separator character that can
155     + // appear in a URI for >20 years now, some widespread applications
156     + // are using URI characters (':' (colon) in particular) for a
157     + // namespace separator, in practice. To keep these applications
158     + // functional, we only reject namespaces URIs containing the
159     + // application-chosen namespace separator if the chosen separator
160     + // is a non-URI character with regard to RFC 3986.
161     + if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator)
162     + && ! is_rfc3986_uri_char(uri[len])) {
163     return XML_ERROR_SYNTAX;
164     }
165     }

  ViewVC Help
Powered by ViewVC 1.1.30