diff --git a/src/share/classes/java/util/regex/Pattern.java b/src/share/classes/java/util/regex/Pattern.java index 009a46e6f6d6766a2b2aeb56b95775b763989409..74343901220e9e4b054dd64f331cd6f4662f2409 100644 --- a/src/share/classes/java/util/regex/Pattern.java +++ b/src/share/classes/java/util/regex/Pattern.java @@ -1348,7 +1348,11 @@ public final class Pattern localCount = 0; if (pattern.length() > 0) { - compile(); + try { + compile(); + } catch (StackOverflowError soe) { + throw error("Stack overflow during pattern compilation"); + } } else { root = new Start(lastAccept); matchRoot = lastAccept; @@ -1905,6 +1909,10 @@ loop: for(int x=0, offset=0; x patternLength) { + cursor = patternLength; + ch = temp[cursor++]; + } return ch; } @@ -1915,6 +1923,10 @@ loop: for(int x=0, offset=0; x patternLength) { + cursor = patternLength; + ch = temp[cursor]; + } return ch; }