From 52f96f5ba18b641320de6db5ffda3d94d1508569 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Sun, 3 Aug 2003 11:48:43 +0000 Subject: [PATCH] Fixing Bug 116517 --- ChangeLog | 8 ++++++++ libxslt/templates.c | 20 ++++++++++++++++++++ tests/docs/Makefile.am | 1 + tests/docs/bug-126.xml | 1 + tests/general/Makefile.am | 1 + tests/general/bug-126.out | 9 +++++++++ tests/general/bug-126.xsl | 17 +++++++++++++++++ 7 files changed, 57 insertions(+) create mode 100644 tests/docs/bug-126.xml create mode 100644 tests/general/bug-126.out create mode 100644 tests/general/bug-126.xsl diff --git a/ChangeLog b/ChangeLog index b24f11e..1680ddc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Aug 3 19:46:42 HTK 2003 William Brack + + Fixed bug 116517 - handling of '{' and '}' + * templates.c: added checks for escaping and balancing of + curly brackets + * tests/general/Makefile.am tests/docs/Makefile.am: + Added test case (bug-126) to regression suite. + Sun Aug 3 15:50:51 HKT 2003 William Brack Fixed bug 117552 - sort with multiple keys diff --git a/libxslt/templates.c b/libxslt/templates.c index 93c0416..80bd063 100644 --- a/libxslt/templates.c +++ b/libxslt/templates.c @@ -247,11 +247,20 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, cur = str; while (*cur != 0) { if (*cur == '{') { + if (*(cur+1) == '{') { /* escaped '{' */ + cur++; + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } ret = xmlStrncat(ret, str, cur - str); str = cur; cur++; while ((*cur != 0) && (*cur != '}')) cur++; if (*cur == 0) { + xsltTransformError(ctxt, NULL, NULL, + "xsltAttrTemplateValueProcessNode: unmatched '{'\n"); ret = xmlStrncat(ret, str, cur - str); return(ret); } @@ -288,6 +297,17 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, } cur++; str = cur; + } else if (*cur == '}') { + cur++; + if (*cur == '}') { /* escaped '}' */ + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } else { + xsltTransformError(ctxt, NULL, NULL, + "xsltAttrTemplateValueProcessNode: unmatched '}'\n"); + } } else cur++; } diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am index 9ca0715..62361d3 100644 --- a/tests/docs/Makefile.am +++ b/tests/docs/Makefile.am @@ -125,6 +125,7 @@ EXTRA_DIST = \ bug-123.xml \ bug-124.xml \ bug-125.xml \ + bug-126.xml \ character.xml \ array.xml \ items.xml diff --git a/tests/docs/bug-126.xml b/tests/docs/bug-126.xml new file mode 100644 index 0000000..69d62f2 --- /dev/null +++ b/tests/docs/bug-126.xml @@ -0,0 +1 @@ + diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am index 982faa0..4091d23 100644 --- a/tests/general/Makefile.am +++ b/tests/general/Makefile.am @@ -130,6 +130,7 @@ EXTRA_DIST = \ bug-123.out bug-123.xsl \ bug-124.out bug-124.xsl \ bug-125.out bug-125.xsl \ + bug-126.out bug-126.xsl \ character.out character.xsl \ character2.out character2.xsl \ itemschoose.out itemschoose.xsl \ diff --git a/tests/general/bug-126.out b/tests/general/bug-126.out new file mode 100644 index 0000000..95ecafd --- /dev/null +++ b/tests/general/bug-126.out @@ -0,0 +1,9 @@ + + + Expect '$x' + Expect 'val' + Expect 'bracket $x' + Expect '$x bracket' + Expect 'bracket $x bracket' + Expect 'bracket val bracket' + diff --git a/tests/general/bug-126.xsl b/tests/general/bug-126.xsl new file mode 100644 index 0000000..1fbd406 --- /dev/null +++ b/tests/general/bug-126.xsl @@ -0,0 +1,17 @@ + + + + + + + + Expect '$x' + Expect 'val' + Expect 'bracket $x' + Expect '$x bracket' + Expect 'bracket $x bracket' + Expect 'bracket val bracket' + + + -- 2.7.4