summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-03-04 11:59:24 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-03-04 11:59:24 +0000
commit968ea0cc7cba9a3b8e6ee895ac62ca7eb571e0f7 (patch)
tree08b3a709ebf24245e924160277dfb577a1e6cb6e
parentb929b5beba91a31e5dfdce5091c05ac51cb7e7bb (diff)
downloadlibxslt-968ea0cc7cba9a3b8e6ee895ac62ca7eb571e0f7.tar.gz
libxslt-968ea0cc7cba9a3b8e6ee895ac62ca7eb571e0f7.tar.bz2
libxslt-968ea0cc7cba9a3b8e6ee895ac62ca7eb571e0f7.zip
fixed bug #73363, bad tokenization of pattern Daniel
* libxslt/pattern.c: fixed bug #73363, bad tokenization of pattern Daniel
-rw-r--r--ChangeLog5
-rw-r--r--libxslt/pattern.c19
2 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 460122ef..27b5760f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 4 12:57:21 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/pattern.c: fixed bug #73363, bad tokenization of
+ pattern
+
Mon Mar 4 12:01:34 CET 2002 Daniel Veillard <daniel@veillard.com>
* libexslt/date.c: patch from Charles Bozeman for the exslt date
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 71a18442..4e6d0b7d 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,