https://issues.apache.org/bugzilla/show_bug.cgi?id=56991

            Bug ID: 56991
           Summary: Request attribute org.apache.catalina.jsp_file needs
                    to be nulled out after single use
           Product: Tomcat 8
           Version: 8.0.12
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: j...@mortbay.com

See JspServlet lines 302-304:

   // JSP specified via <jsp-file> in <servlet> declaration and supplied
through
   //custom servlet container code
   jspUri = (String) request.getAttribute(Constants.JSP_FILE);


The comment here implies that the container uses this method to identify a
servlet that is declared with a jsp-file attribute. However, tomcat actually
uses the init-param "jspFile" on a copy of the JspServlet with the name of the
target jsp instead.

If a container sets this attribute as per the comment, it can cause stack
overflow when jsp including is used:

 a.jsp is defined in a jsp-file on a servlet in web.xml
 a.jsp includes b.jsp

When a.jsp is serviced it does an include dispatch to b.jsp. When the
JspServlet is called for b.jsp, it sees that the request attribute with a.jsp
is set, so processes it again ... which does an include dispatch for b.jsp ...
which causes a.jsp to be processed again .... and then rinse and repeat.

Note that Glassfish nulls out this attribute after it has been detected:

  if (jspFile != null) {
            // JSP is specified via <jsp-file> in <servlet> declaration
            jspUri = jspFile;
            request.removeAttribute(Constants.JSP_FILE);
        } else {

Jan

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to