mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Fix a parsing bug on non-ascii element and CR/LF usage
https://bugzilla.gnome.org/show_bug.cgi?id=698550 Somehow the behaviour of the internal parser routine changed slightly when encountering CR/LF, which led to a bug when parsing document with non-ascii Names
This commit is contained in:
parent
e38217ae82
commit
dcc1950319
6
parser.c
6
parser.c
@ -3404,6 +3404,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
int len = 0, l;
|
||||
int c;
|
||||
int count = 0;
|
||||
const xmlChar *end; /* needed because CUR_CHAR() can move cur on \r\n */
|
||||
|
||||
#ifdef DEBUG
|
||||
nbParseNCNameComplex++;
|
||||
@ -3413,6 +3414,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
* Handler for more complex cases
|
||||
*/
|
||||
GROW;
|
||||
end = ctxt->input->cur;
|
||||
c = CUR_CHAR(l);
|
||||
if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
|
||||
(!xmlIsNameStartChar(ctxt, c) || (c == ':'))) {
|
||||
@ -3434,12 +3436,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
}
|
||||
len += l;
|
||||
NEXTL(l);
|
||||
end = ctxt->input->cur;
|
||||
c = CUR_CHAR(l);
|
||||
if (c == 0) {
|
||||
count = 0;
|
||||
GROW;
|
||||
if (ctxt->instate == XML_PARSER_EOF)
|
||||
return(NULL);
|
||||
end = ctxt->input->cur;
|
||||
c = CUR_CHAR(l);
|
||||
}
|
||||
}
|
||||
@ -3448,7 +3452,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
|
||||
xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
|
||||
return(NULL);
|
||||
}
|
||||
return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
|
||||
return(xmlDictLookup(ctxt->dict, end - len, len));
|
||||
}
|
||||
|
||||
/**
|
||||
|
4
result/japancrlf.xml
Normal file
4
result/japancrlf.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<入力メッセージ xmlns="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826">
|
||||
<c8c:Ele xmlns:c8c="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826"/>
|
||||
</入力メッセージ>
|
7
result/japancrlf.xml.rde
Normal file
7
result/japancrlf.xml.rde
Normal file
@ -0,0 +1,7 @@
|
||||
0 1 入力メッセージ 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
1 1 c8c:Ele 1 0
|
||||
1 14 #text 0 1
|
||||
|
||||
0 15 入力メッセージ 0 0
|
7
result/japancrlf.xml.rdr
Normal file
7
result/japancrlf.xml.rdr
Normal file
@ -0,0 +1,7 @@
|
||||
0 1 入力メッセージ 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
1 1 c8c:Ele 1 0
|
||||
1 14 #text 0 1
|
||||
|
||||
0 15 入力メッセージ 0 0
|
11
result/japancrlf.xml.sax
Normal file
11
result/japancrlf.xml.sax
Normal file
@ -0,0 +1,11 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.startElement(入力メッセージ, xmlns='http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826')
|
||||
SAX.characters(
|
||||
, 2)
|
||||
SAX.startElement(c8c:Ele, xmlns:c8c='http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826')
|
||||
SAX.endElement(c8c:Ele)
|
||||
SAX.characters(
|
||||
, 1)
|
||||
SAX.endElement(入力メッセージ)
|
||||
SAX.endDocument()
|
11
result/japancrlf.xml.sax2
Normal file
11
result/japancrlf.xml.sax2
Normal file
@ -0,0 +1,11 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.startElementNs(入力メッセージ, NULL, 'http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826', 1, xmlns='http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826', 0, 0)
|
||||
SAX.characters(
|
||||
, 2)
|
||||
SAX.startElementNs(Ele, c8c, 'http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826', 1, xmlns:c8c='http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826', 0, 0)
|
||||
SAX.endElementNs(Ele, c8c, 'http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826')
|
||||
SAX.characters(
|
||||
, 1)
|
||||
SAX.endElementNs(入力メッセージ, NULL, 'http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826')
|
||||
SAX.endDocument()
|
4
result/noent/japancrlf.xml
Normal file
4
result/noent/japancrlf.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<入力メッセージ xmlns="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826">
|
||||
<c8c:Ele xmlns:c8c="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826"/>
|
||||
</入力メッセージ>
|
6
test/japancrlf.xml
Normal file
6
test/japancrlf.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<入力メッセージ
|
||||
xmlns="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826">
|
||||
<c8c:Ele
|
||||
xmlns:c8c="http://schemas.cordys.com/webapps/1.0/bpm/c8c8b82a-0ac0-3d19-01e2-bda74af9b826"
|
||||
/>
|
||||
</入力メッセージ>
|
Loading…
x
Reference in New Issue
Block a user