Author: markt Date: Thu Apr 17 15:44:07 2014 New Revision: 1588288 URL: http://svn.apache.org/r1588288 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56409 Avoid StackOverflowError on non-Windows systems if a file named '\' is encountered when scanning for TLDs.
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1588288&r1=1588287&r2=1588288&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Thu Apr 17 15:44:07 2014 @@ -16,6 +16,7 @@ */ package org.apache.catalina.core; +import java.io.File; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; @@ -638,7 +639,16 @@ public class ApplicationContext (sm.getString("applicationContext.resourcePaths.iae", path)); } - String normalizedPath = RequestUtil.normalize(path); + String normalizedPath; + if (File.separatorChar == '\\') { + // On Windows '\\' is a separator so in case a Windows style + // separator has managed to make it into the path, replace it. + normalizedPath = RequestUtil.normalize(path, true); + } else { + // On UNIX and similar systems, '\\' is a valid file name so do not + // convert it to '/' + normalizedPath = RequestUtil.normalize(path, false); + } if (normalizedPath == null) return (null); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1588288&r1=1588287&r2=1588288&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Apr 17 15:44:07 2014 @@ -91,6 +91,11 @@ Only create XML parsing objects if required and fix associated potential memory leak in the default Servlet. (markt) </fix> + <fix> + <bug>56409</bug>: Avoid <code>StackOverflowError</code> on non-Windows + systems if a file named <code>\</code> is encountered when scanning for + TLDs. (mark) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org