Author: markt Date: Thu Apr 17 15:01:07 2014 New Revision: 1588272 URL: http://svn.apache.org/r1588272 Log: Avoid StackOverflowError on non-Windows systems if a file named '\' is encountered when scanning for TLDs.
Modified: tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java?rev=1588272&r1=1588271&r2=1588272&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/StandardRoot.java Thu Apr 17 15:01:07 2014 @@ -238,7 +238,16 @@ public class StandardRoot extends Lifecy sm.getString("standardRoot.invalidPath", path)); } - String result = RequestUtil.normalize(path); + String result; + 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. + result = RequestUtil.normalize(path, true); + } else { + // On UNIX and similar systems, '\\' is a valid file name so do not + // convert it to '/' + result = RequestUtil.normalize(path, false); + } if (result == null || result.length() == 0 || !result.startsWith("/")) { throw new IllegalArgumentException( sm.getString("standardRoot.invalidPathNormal", path, result)); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1588272&r1=1588271&r2=1588272&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Apr 17 15:01:07 2014 @@ -116,6 +116,11 @@ <code>StackOverflowError</code> is not treated as a fatal error and can handled and/or logged as required. (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="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org