diff options
author | Daniel Veillard <veillard@redhat.com> | 2013-05-22 22:56:45 +0200 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2013-05-22 22:56:45 +0200 |
commit | dcc19503193c71596278a252064a8ce66331b3cd (patch) | |
tree | c2df8cc1d46561ac32bcd5ef686ea913418e63e8 /parser.c | |
parent | e38217ae82612f1c98c21e8fc16c2f823967bd49 (diff) | |
download | android_external_libxml2-dcc19503193c71596278a252064a8ce66331b3cd.tar.gz android_external_libxml2-dcc19503193c71596278a252064a8ce66331b3cd.tar.bz2 android_external_libxml2-dcc19503193c71596278a252064a8ce66331b3cd.zip |
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
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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)); } /** |