Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52335
Only handle <\% and not \% as escaped in template text.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc5.5.x/trunk@1221479 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/STATUS.txt b/STATUS.txt
index d0de5e0..250dc85 100644
--- a/STATUS.txt
+++ b/STATUS.txt
@@ -24,12 +24,6 @@
PATCHES ACCEPTED TO BACKPORT FROM TRUNK/OTHER:
[ start all new proposals below, under PATCHES PROPOSED. ]
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52335
- Only handle <\% and not \% as escaped in template text.
- http://svn.apache.org/viewvc?rev=1215121&view=rev
- +1: markt, funkman, jim
- -1:
-
PATCHES PROPOSED TO BACKPORT:
[ New proposals should be added at the end of the list ]
diff --git a/container/webapps/docs/changelog.xml b/container/webapps/docs/changelog.xml
index b5da2d2..efc14de 100644
--- a/container/webapps/docs/changelog.xml
+++ b/container/webapps/docs/changelog.xml
@@ -67,6 +67,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>52335</bug>: Only handle <code><\%</code> and not
+ <code>\%</code> as escaped in template text. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Webapps">
<changelog>
<fix>
diff --git a/jasper/src/share/org/apache/jasper/compiler/Parser.java b/jasper/src/share/org/apache/jasper/compiler/Parser.java
index 88f5951..ba9f81e 100644
--- a/jasper/src/share/org/apache/jasper/compiler/Parser.java
+++ b/jasper/src/share/org/apache/jasper/compiler/Parser.java
@@ -1405,6 +1405,7 @@
}
while (reader.hasMoreInput()) {
+ int prev = ch;
ch = reader.nextChar();
if (ch == '<') {
reader.pushChar();
@@ -1430,10 +1431,11 @@
ttext.write('\\');
break;
}
- // Look for \% or \$
+ // Look for <\% or \$
// Only recognize \$ if isELIgnored is false
char next = (char)reader.peekChar();
- if (next == '%' || (next == '$' && !pageInfo.isELIgnored())) {
+ if ((prev == '<' && next == '%') ||
+ (next == '$' && !pageInfo.isELIgnored())) {
ch = reader.nextChar();
}
}