fixed an UTF-8 parsing bug reported by Markus Bertheau on #fedora-devel

* xpath.c: fixed an UTF-8 parsing bug reported by Markus Bertheau
  on #fedora-devel
Daniel
This commit is contained in:
Daniel Veillard 2004-11-01 14:55:21 +00:00
parent acbe6cfd96
commit 032268145f
2 changed files with 28 additions and 24 deletions

View File

@ -1,3 +1,8 @@
Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com>
* xpath.c: fixed an UTF-8 parsing bug reported by Markus Bertheau
on #fedora-devel
Sun Oct 31 22:03:38 CET 2004 Daniel Veillard <daniel@veillard.com>
* parser.c: fixed a bug reported by Petr Pajas on the list and

47
xpath.c
View File

@ -8012,35 +8012,34 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
static xmlChar *
xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
xmlChar buf[XML_MAX_NAMELEN];
int len = 0;
int len = 0, l;
int c;
int count = 0;
const xmlChar *cur;
xmlChar *ret;
SKIP_BLANKS;
if (!IS_ASCII_LETTER(CUR) && (CUR != '_') &&
(CUR != ':')) {
cur = ctxt->cur;
c = CUR_CHAR(l);
if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
(!IS_LETTER(c) && (c != '_') &&
(c != ':'))) {
return(NULL);
}
while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) ||
(NXT(len) == '.') || (NXT(len) == '-') ||
(NXT(len) == '_') || (NXT(len) == ':') ||
(IS_COMBINING_CH(NXT(len))) ||
(IS_EXTENDER_CH(NXT(len)))) {
buf[len] = NXT(len);
len++;
if (len >= XML_MAX_NAMELEN) {
xmlGenericError(xmlGenericErrorContext,
"xmlScanName: reached XML_MAX_NAMELEN limit\n");
while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) ||
(NXT(len) == '.') || (NXT(len) == '-') ||
(NXT(len) == '_') || (NXT(len) == ':') ||
(IS_COMBINING_CH(NXT(len))) ||
(IS_EXTENDER_CH(NXT(len))))
len++;
break;
}
while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
((IS_LETTER(c)) || (IS_DIGIT(c)) ||
(c == '.') || (c == '-') ||
(c == '_') || (c == ':') ||
(IS_COMBINING(c)) ||
(IS_EXTENDER(c)))) {
len += l;
NEXTL(l);
c = CUR_CHAR(l);
}
return(xmlStrndup(buf, len));
ret = xmlStrndup(cur, ctxt->cur - cur);
ctxt->cur = cur;
return(ret);
}
/**