Bug 11984 - Regexp crashes on patterns, with char sequences longer than 15 chars
Summary: Regexp crashes on patterns, with char sequences longer than 15 chars
Status: CLOSED INVALID
Alias: None
Product: Regexp
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC All
: P3 major (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-23 16:54 UTC by Deyan Tsvetanov
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deyan Tsvetanov 2002-08-23 16:54:11 UTC
when the limits of the pattern in the program bellow are {4, 15} - everything 
is ok and works. but when the right boundary is > 15, and the string, passed to 
match is shorter than 16 chars, a java.lang.ArrayIndexOutOfBoundsException
is being thrown. 
stacktrace:

 at org.apache.regexp.RE.getParenEnd(RE.java:719)
 at org.apache.regexp.RE.matchNodes(RE.java:937)
 at org.apache.regexp.RE.matchNodes(RE.java:905)
 at org.apache.regexp.RE.matchNodes(RE.java:928)
 at org.apache.regexp.RE.matchNodes(RE.java:905)
... continues. 
I use win2k service pack 2, build 5.00.2195, 
JDK 1.3.1 :

java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)



import org.apache.regexp.*;
public class RegExpTest {
	public static void main(String[] args) {
	try {	
			RE re = new RE("^(\\w){4,16}$");
			System.out.println("mathes: " + re.match(args[0]));
		}catch (RESyntaxException re) {
			re.printStackTrace();
		}
	}
}
Comment 1 Deyan Tsvetanov 2002-08-26 07:47:51 UTC
actually this exception occurs only when  RE.match should return true - e.g. 
when the chars in the word are between 4, 16. if the right limit is <= 15, 
everything is ok - it returns true || false. but when it is bigger than 15, it 
returns false as expected, but when the string matches the regexpression, and 
we expect true, this exception is being thrown
Comment 2 Vadim Gritsenko 2003-06-01 17:42:37 UTC
Tried with 1.3-dev with following in RETest.txt:

#1
^(\w){4,16}$
abcdefghijklmnop
YES
abcdefghijklmnop
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p


No exception were thrown. Please try and if you can able to reproduce exception,
reopen the bug, and specify exact arguments reproducing it.
Comment 3 Vadim Gritsenko 2003-06-01 17:42:52 UTC
closed