From: Daniel Veillard Date: Mon, 4 Mar 2002 11:59:24 +0000 (+0000) Subject: fixed bug #73363, bad tokenization of pattern Daniel X-Git-Tag: v1.1.28~999 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=968ea0cc7cba9a3b8e6ee895ac62ca7eb571e0f7;p=platform%2Fupstream%2Flibxslt.git fixed bug #73363, bad tokenization of pattern Daniel * libxslt/pattern.c: fixed bug #73363, bad tokenization of pattern Daniel --- diff --git a/ChangeLog b/ChangeLog index 460122e..27b5760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Mar 4 12:57:21 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed bug #73363, bad tokenization of + pattern + Mon Mar 4 12:01:34 CET 2002 Daniel Veillard * libexslt/date.c: patch from Charles Bozeman for the exslt date diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 71a1844..4e6d0b7 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -1611,7 +1611,7 @@ xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, xsltTransformContextPtr runtime) { xsltParserContextPtr ctxt = NULL; xsltCompMatchPtr element, first = NULL, previous = NULL; - int current, start, end; + int current, start, end, level; if (pattern == NULL) { xsltPrintErrorContext(NULL, NULL, node); /* TODO */ @@ -1631,8 +1631,23 @@ xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, while (IS_BLANK(pattern[current])) current++; end = current; - while ((pattern[end] != 0) && (pattern[end] != '|')) + level = 0; + while ((pattern[end] != 0) && ((pattern[end] != '|') || (level != 0))) { + if (pattern[end] == '[') + level++; + else if (pattern[end] == ']') + level--; + else if (pattern[end] == '\'') { + end++; + while ((pattern[end] != 0) && (pattern[end] != '\'')) + end++; + } else if (pattern[end] == '"') { + end++; + while ((pattern[end] != 0) && (pattern[end] != '"')) + end++; + } end++; + } if (current == end) { xsltPrintErrorContext(NULL, NULL, node); /* TODO */ xsltGenericError(xsltGenericErrorContext,