Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3268

SimpleUrlPattern crashes (infinite loop) for certain pattern and URL combinations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.3.6
    • 4.3.2
    • core
    • None
    • 1.6.0_07 and 1.6.0_16, win32.
    • Yes

      As of 4.3.2, in which the constant URL_CHAR_PATTERN in SimpleUrlPattern was changed, some URL pattern matches cause hang-ups.

      import info.magnolia.cms.util.SimpleUrlPattern;
      
      import org.junit.Assert;
      import org.junit.Test;
      
      public class SimpleUrlPatternTest
      {
         @Test
         public void testDotDoPattern()
         {
            final SimpleUrlPattern sup = new SimpleUrlPattern("*\\.do");
            Assert.assertTrue(sup.match("/path/myController.do")); //This still works
            Assert.assertFalse(sup.match("/.resources/enterprise-css/registration.css")); //This hangs up
         }
      }
      

      I noticed this because I have a URL bypass for Spring controller URLs which I've mapped to *.do extensions.

      It seems SimpleUrlPattern converts

      *\\.do

      to

      ()(.*\\n*)*\\.do

      internally, which causes an infinite loop in java.util.regex.Pattern. I tested this with both JDK 1.6.0_07 and 1.6.0_16.

        Acceptance criteria

              ochytil Ondrej Chytil
              ben.cody@gmail.com Benjamin Cody
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD