Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8145170

StackOverflowError at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
      Java HotSpot(TM) Client VM (build 25.66-b18, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      icrosoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      StackOverflowError occurs when invoking Matcher.find() with some data sets

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Test case requires:
      - com.google.guava : guava : 18.0
      - test data from here https://raw.githubusercontent.com/twbs/bootstrap/86eac52cceb6b215bf14636f9d8db97c6987777d/less/scaffolding.less

      Note: failing code line is taken from http://yui.github.io/yuicompressor/

          @Test
          public void testSomeMethod() throws IOException {
              URL url = Resources.getResource(this.getClass(), "scaffolding.css");
              String css = Resources.toString(url, Charsets.UTF_8);
              Pattern p = Pattern.compile("(\"([^\\\\\"]|\\\\.|\\\\)*\")|(\'([^\\\\\']|\\\\.|\\\\)*\')");
              Matcher m = p.matcher(css);
              
              for( int i = 1; m.find(); i++ ) {
                  System.out.print("Found match #" + i);
              }
          }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      'm.find()' should return true/false without StackOverflowError
      ACTUAL -
      StackOverflowError occurs

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.StackOverflowError
      at java.lang.Character.codePointAt(Character.java:4866)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3775)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
      at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
      at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
      at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
      at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3777)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
      at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
      at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
      at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
      at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3777)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
      ...

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See "Steps to Reproduce"
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Unknown

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sherman Xueming Shen
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: