You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by bu...@apache.org on 2003/07/10 15:58:01 UTC

DO NOT REPLY [Bug 21469] New: - StackOverflowError in RE.matchNodes() with 1614 bytes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21469>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21469

StackOverflowError in RE.matchNodes() with 1614 bytes

           Summary: StackOverflowError in RE.matchNodes() with 1614 bytes
           Product: Regexp
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Other
        AssignedTo: regexp-dev@jakarta.apache.org
        ReportedBy: GKAlbrecht@gmx.de


Hello Regexp team,

I found an error in RE.java version 1.13 (also in version 1.2).
The test code is trivial:

--------------------------------------------------------------------------
package de;

import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;

public class TestRegExp
{

  public static void main(String[] args)
  {
    RE re = null;
    try
    {
      re = new RE(".*");

      byte[] bytes = new byte[1613]; // 1613 is OK; 1614 StackOverflowError
    
      // AAAAAAAAAAAAAA.....AZ
      for (int i=0; i<bytes.length; ++i)
      {
        bytes[i] = 'A';
      }
      bytes[bytes.length-1] = 'Z';
    
      String string = new String(bytes);
    
      System.out.println(">" + string + "\nmatch: " + re.match(string));
    }
    catch (RESyntaxException e)
    {
      e.printStackTrace();
    }
  }
}
--------------------------------------------------------------------------

With 1613 bytes the output is:
>AAAAAAAAAAAAAA.....AZ
match: true

But with 1614 bytes it looks like (RE.java,v 1.13 2003/06/02 02:18:41 
vgritsenko Exp):
java.lang.StackOverflowError
	at org.apache.regexp.RE.matchNodes(RE.java:1153)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
...................
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
	at org.apache.regexp.RE.matchNodes(RE.java:1408)
Exception in thread "main" 

Thanks in advance

G�nter Albrecht

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org