jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 6838] New: - ORO hangs with regular expression in Perl5Util
Date Mon, 04 Mar 2002 09:55:10 GMT
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=6838>.
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=6838

ORO hangs with regular expression in Perl5Util

           Summary: ORO hangs with regular expression in Perl5Util
           Product: ORO
           Version: 2.0.5
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Main
        AssignedTo: oro-dev@jakarta.apache.org
        ReportedBy: Alexander.Frink@accenture.com


Hi,

with the pattern and the second test string (about 12kB)
in the program below, ORO-2.0.5 hangs indefinitely (100% CPU usage).
A thread dump shows it hangs in Perl5Matcher.__match():

[1] org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:863)
[2] org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:863)
[3] org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:863)
[4] org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:863)
[5] org.apache.oro.text.regex.Perl5Matcher.__match(Perl5Matcher.java:863)
[6] org.apache.oro.text.regex.Perl5Matcher.__tryExpression(Perl5Matcher.java:743
)
[7] org.apache.oro.text.regex.Perl5Matcher.__interpret(Perl5Matcher.java:299)
[8] org.apache.oro.text.regex.Perl5Matcher.contains(Perl5Matcher.java:1747)
[9] org.apache.oro.text.perl.Perl5Util.match(Perl5Util.java:356)
[10] org.apache.oro.text.perl.Perl5Util.match(Perl5Util.java:403)
[11] Test.main(Test.java:11)

This happens on Solaris 8 and Win 2000, also with an older
ORO-2.0.1.

--------- TEST PROGRAM, CUT HERE ---------------------------

import java.io.*;
import org.apache.oro.text.perl.Perl5Util;

public class Test {
    public static void main(String[] args)
    {
        String pattern =
            "/<script.*?top\\.location.*?=.*?'(.*?)'.*?<\\/script>/";
        Perl5Util util = new Perl5Util();
        boolean matched1 = util.match(pattern,getValue1());  // passes OK
        System.out.println("first match returned " + matched1);
        boolean matched2 = util.match(pattern,getValue2()); // hangs
        System.out.println("second match returned " + matched2);
    }

    private static String getValue1()
    {
         return "<script language=\"JavaScript\"> <!-- top.lo" +
             "cation='foobar'; --> </script>";
    }

    private static String getValue2()
    {
        return
"<html><head>    <script language=\"JavaScript\">    <!--  " +
"  if (!(self.name == \"xx_home\") && (self.name != \"viewe" +
"rWindow\"))    {        location.href=\"http://www.xxxxxxx" +
"xxxxxx.de\";    }    //--></SCRIPT><meta http-equiv=\"prag" +
"ma\" content=\"no-cache\"><meta http-equiv=\"Expires\" con" +
"tent=\"Thu, 01 Jan 1970 00:00:01 GMT\"><meta http-equiv=\"" +
"refresh\" content=\"900; URL=/portal/func/common/timeout.j" +
"sp?src=%2Ffunc%2Fcommon%2Fstart_public.jsp&time=2002030114" +
"3911000&Session=PH2EfbdF7rZu6Vi1Xx9Qxxp6Ckix2xXxwiDt4g3eeM" +
"HKfg2IAtok|8721859357816600716/-1456732014/6/7001/7001/700" +
"2/7002/7001/-1\">    <title>xxxxxxxxxxxxxxxxxxxxxxxxx</tit" +
"le>    <link type=\"text/css\" rel=\"stylesheet\" href=\"." +
"./../sh/css/xx_main.css\"></head><body>     <!-- xxxxxxxxx" +
"xxxxxxxxxxxxx --><!-- xxxxxxxxxxxxxxxxxxxxxx --><script la" +
"nguage=\"JavaScript\" src=\"/portal/sh/js/funktionen.js?Se" +
"ssion=PH2EfbdF7rZu6Vi1Xx9Qxxp6Ckix2xXxwiDt4g3eeMHKfg2IAtok" +
"|8721859357816600716/-1456732014/6/7001/7001/7002/7002/700" +
"1/-1\" type=\"text/javascript\"><!-- script --></script><s" +
"cript language=\"JavaScript\" src=\"/portal/sh/js/remoteMe" +
"nu.js?Session=PH2EfbdF7rZu6Vi1Xx9Qxxp6Ckix2xXxwiDt4g3eeMHK" +
"fg2IAtok|8721859357816600716/-1456732014/6/7001/7001/7002/" +
"7002/7001/-1\" type=\"text/javascript\"><!-- script --></s" +
"cript><script language=\"JavaScript\" type=\"text/javascri" +
"pt\"><!-- function openWin(url) { viewerWindow = window.op" +
"en(url,\"viewerWindow\",\"width=625,height=500,resizable=n" +
"o,scrollbars=yes\"); viewerWindow.focus();}/**  * This met" +
"hod opens a page in a new window and inserts the SessionID" +
" a the current layer;  * usage: <a href=\"javascript:openW" +
"in('tools/ycal/yieldnewinput.htm');\">Link</a>  * @param o" +
"penUrl   the url beginning at the root of the web i.e. wit" +
"hout '../../'  *                  and without the host add" +
"ress i.e. without 'http://www.xxxxxxxxxxxxx.de'  */  funct" +
"ion openWin2(openUrl) {  var url = window.location.href; v" +
"ar strAddr = \"www.xxxxxxxxxxxxx.de\"; var addrLen = strAd" +
"dr.length; var pos = url.indexOf(strAddr) + addrLen + 1; w" +
"hile(url.charAt(pos) != \"/\") {  ++pos; } ++pos;  url = u" +
"rl.substring(0, pos);   var qs = window.location.search;  " +
"qs = qs.substring(1, qs.length);  var params = qs.split(\"" +
"?\"); var session = \"\"; for(i = 0; i < params.length; ++" +
"i) {  if(params[i].indexOf(\"Session\") > -1)  {   session" +
" = params[i];  } }  if(openUrl.indexOf(\"?\") > - 1 && ses" +
"sion.length > 0)  openUrl += \"&\" + session; else if(sess" +
"ion.length > 0)  openUrl += \"?\" + session;  url += openU" +
"rl;  viewerWindow = window.open(url,\"viewerWindow\",\"wid" +
"th=625,height=500,resizable=no,scrollbars=yes\"); viewerWi" +
"ndow.focus();}function wolink(plink, fi, si, tk){ var pfad" +
"; var url = window.location.href; var strAddr = \"www.xxxx" +
"xxxxxxxxx.de\"; var addrLen = strAddr.length; var pos = ur" +
"l.indexOf(strAddr) + addrLen + 1; while(url.charAt(pos) !=" +
" \"/\") {  ++pos; } ++pos;  url = url.substring(0, pos);  " +
" var qs = window.location.search;  qs = qs.substring(1, qs" +
".length);  var params = qs.split(\"?\"); var session = \"\"" +
"; for(i = 0; i < params.length; ++i) {  if(params[i].index" +
"Of(\"Session\") > -1)  {   session = params[i];  } }  url " +
"+= \"default.jsp?\" + session + \"&\"; if (plink=='chart')" +
" {  pfad= url + 'page=main&pageLoad=../../tools/chartana/c" +
"hartanalyzer.jsp?wkn=876800&stk=sha&ste=FRA' + '&expandAct" +
"ion=expand&flindex=' + fi + '&slindex=' + si; } else {  if" +
" (tk!='0')  {   pfad= url + 'page=main&pageLoad=../../' + " +
"plink + '&expandAction=expand&flindex=' + fi + '&slindex='" +
" + si + '&treeKey=' + tk;  }  else  {   pfad= url + 'page=" +
"main&pageLoad=../../' + plink + '&expandAction=expand&flin" +
"dex=' + fi + '&slindex=' + si;  } } top.location.href=pfad" +
";}// --></script><table border=\"0\" cellpadding=\"0\" cel" +
"lspacing=\"0\" width=\"588\"> <tr> <td width=\"182\"><img " +
"alt=\"\" border=\"0\" height=\"1\" src=\"/portal/sh/gfx/sp" +
"acer.gif\" width=\"182\"/></td> <td width=\"21\"><img alt=" +
"\"\" border=\"0\" height=\"1\" src=\"/portal/sh/gfx/spacer" +
".gif\" width=\"21\"/></td> <td width=\"182\"><img alt=\"\"" +
" border=\"0\" height=\"1\" src=\"/portal/sh/gfx/spacer.gif" +
"\" width=\"182\"/></td> <td colspan=\"2\" rowspan=\"4\" va" +
"lign=\"top\" width=\"203\"><img alt=\"\" border=\"0\" heig" +
"ht=\"259\" src=\"/portal/sh/img6/home.jpg\" width=\"203\"/" +
"></td> </tr> <tr> <td class=\"pagetitle\" colspan=\"3\" he" +
"ight=\"77\" valign=\"bottom\">xxxxxxxxxxxxxxxxxxxxxxxxx <b" +
"r /><img alt=\"\" border=\"0\" height=\"21\" src=\"/portal" +
"/sh/gfx/spacer.gif\" width=\"1\"/></td> </tr> <tr> <td cla" +
"ss=\"contenttext\" colspan=\"3\">xxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br /> <br />  </td> </tr> " +
"<tr valign=\"top\"> <td> <table bgcolor=\"#0099CD\" border" +
"=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">" +
"  <tr>  <td>  <table bgcolor=\"#FFFFFF\" border=\"0\" cell" +
"padding=\"0\" cellspacing=\"0\">   <tr>   <td>   <table bg" +
"color=\"#EEF8FF\" border=\"0\" cellpadding=\"3\" cellspaci" +
"ng=\"0\" width=\"100%\">    <tr>    <td class=\"tableheadl" +
"ine\">Ohne Umwege zum Ziel</td>    </tr>   </table></td>  " +
" </tr>   <tr valign=\"top\">   <td>   <table border=\"0\" " +
"cellpadding=\"0\" cellspacing=\"0\">    <tr>    <td><img a" +
"lt=\"\" border=\"0\" height=\"1\" src=\"/portal/sh/img6/pi" +
"x_blue.gif\" width=\"180\"/></td>    </tr>   </table></td>" +
"   </tr>   <tr valign=\"top\">   <td>   <table border=\"0\"" +
" cellpadding=\"3\" cellspacing=\"0\">    <tr valign=\"top\"" +
">    <td><img alt=\"\" border=\"0\" height=\"12\" src=\"/p" +
"ortal/sh/gfx/arrow_blue_table.gif\" width=\"6\"/></td>    " +
"<td><a href=\"javascript:wolink('content/akt/kursnews/ki_t" +
"op5.htm', '10', '212', '5')\" onMouseOut=\"status=''; retu" +
"rn true;\" onMouseOver=\"status='Aktuelle Kurse'; return t" +
"rue;\">Aktuelle Kurse</a></td>    </tr>    <tr valign=\"to" +
"p\">    <td width=\"1%\"><img alt=\"\" border=\"0\" height" +
"=\"12\" src=\"/portal/sh/gfx/arrow_blue_table.gif\" width=" +
"\"6\"/></td>    <td><a href=\"javascript:wolink('content/f" +
"rag/selobest.htm', '10', '251', '3')\" onMouseOut=\"status" +
"=''; return true;\" onMouseOver=\"status='Die besten Fonds" +
"'; return true;\">Die besten Fonds</a></td>    </tr>    <t" +
"r valign=\"top\">    <td><img alt=\"\" border=\"0\" height" +
"=\"12\" src=\"/portal/sh/gfx/arrow_blue_table.gif\" width=" +
"\"6\"/></td>    <td><a href=\"javascript:callMenu(1, '', 2" +
"1, '../../tools/chartana/chartanalyzer.jsp?wkn=876800&stk=" +
"sha&ste=FRA')\" onMouseOut=\"status=''; return true;\" onM" +
"ouseOver=\"status='Chartanalyse'; return true;\">Chartanal" +
"yse</a></td>    </tr>    <tr valign=\"top\">    <td><img
a" +
"lt=\"\" border=\"0\" height=\"12\" src=\"/portal/sh/gfx/ar" +
"row_blue_table.gif\" width=\"6\"/></td>    <td><a href=\"j" +
"avascript:wolink('content/wezeug/risiksr.htm', '1', '', '2" +
"0')\" onMouseOut=\"status=''; return true;\" onMouseOver=\"" +
"status='Risiko reduzieren'; return true;\">Risiko reduzier" +
"en</a></td>    </tr>    <tr valign=\"top\">    <td><img
al" +
"t=\"\" border=\"0\" height=\"12\" src=\"/portal/sh/gfx/arr" +
"ow_blue_table.gif\" width=\"6\"/></td>    <td><a href=\"ja" +
"vascript:wolink('content/zeitmuse/vermgenie/default.htm', " +
"'12', '626', '10')\" onMouseOut=\"status=''; return true;\"" +
" onMouseOver=\"status='Vermögen genießen'; return true;\">" +
"Vermögen genießen</a></td>    </tr>   </table></td>   </tr"
+
">  </table></td>  </tr> </table> <img alt=\"\" border=\"0\""
+
" height=\"14\" src=\"/portal/sh/gfx/spacer.gif\" width=\"1" +
"\"/>  <table bgcolor=\"#0099CD\" border=\"0\" cellpadding=" +
"\"1\" cellspacing=\"0\" width=\"100%\">  <tr>  <td>  <tabl" +
"e bgcolor=\"#FFFFFF\" border=\"0\" cellpadding=\"0\" cells" +
"pacing=\"0\">   <tr>   <td>   <table bgcolor=\"#EEF8FF\" b" +
"order=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"10" +
"0%\">    <tr>    <td class=\"tableheadline\">Wegweiser</td" +
">    </tr>   </table></td>   </tr>   <tr valign=\"top\">
 " +
" <td>   <table border=\"0\" cellpadding=\"0\" cellspacing=" +
"\"0\">    <tr>    <td><img alt=\"\" border=\"0\" height=\"" +
"1\" src=\"/portal/sh/img6/pix_blue.gif\" width=\"180\"/></" +
"td>    </tr>   </table></td>   </tr>   <tr valign=\"top\">"
+
"   <td>   <table border=\"0\" cellpadding=\"3\" cellspacin" +
"g=\"0\">    <tr valign=\"top\">     <td class=\"tablerowwh" +
"ite\">Hier bietet Ihnen die xxxxxxxxxxxxx die für Sie pass" +
"ende Webseite</td>    </tr>    <tr valign=\"top\">     <td" +
" align=\"right\" class=\"tablerowwhite\"><a href=\"javascr" +
"ipt:openWin2('content/pfinder/default.htm');\"><img border" +
"=\"0\" src=\"/portal/sh/icons/but_weiter_2.gif\"/></a></td" +
">    </tr>   </table></td>   </tr>  </table></td>
 </tr> <" +
"/table>  </td> <td> </td> <td class=\"contenttext\">xxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxx<br />xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br" +
" /> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxx</td> </tr> <tr> <td colspan=\"5\"><img alt=\"\" border" +
"=\"0\" height=\"21\" src=\"/portal/sh/gfx/spacer.gif\" wid" +
"th=\"1\"/></td> </tr> <tr> <td colspan=\"5\"><img alt=\"\""
+
" border=\"0\" height=\"1\" src=\"/portal/sh/gfx/pix_blue.g" +
"if\" width=\"588\"/></td> </tr> <tr height=\"28\"> <td cla" +
"ss=\"contenttext\"><img border=\"0\" height=\"12\" src=\"/" +
"portal/sh/gfx/arrow_blue.gif\" width=\"10\"/><a href=\"jav" +
"ascript:wolink('content/dizupro.htm', '10', '', '')\" onMo" +
"useOut=\"status=''; return true;\" onMouseOver=\"status='D" +
"irekt zum Produkt'; return true;\">Direkt zum Produkt</a><" +
"/td> <td><img alt=\"\" border=\"0\" height=\"1\" src=\"/po" +
"rtal/sh/gfx/spacer.gif\" width=\"21\"/></td> <td class=\"c" +
"ontenttext\"><img border=\"0\" height=\"12\" src=\"/portal" +
"/sh/gfx/arrow_blue.gif\" width=\"10\"/><a href=\"javascrip" +
"t:wolink('content/anlevors.htm', '11', '', '')\" onMouseOu" +
"t=\"status=''; return true;\" onMouseOver=\"status='Anlege" +
"n und Vorsorgen'; return true;\">Anlegen und Vorsorgen</a>" +
"</td> <td><img alt=\"\" border=\"0\" height=\"1\" src=\"/p" +
"ortal/sh/gfx/spacer.gif\" width=\"21\"/></td> <td class=\"" +
"contenttext\"><img border=\"0\" height=\"12\" src=\"/porta" +
"l/sh/gfx/arrow_blue.gif\" width=\"10\"/><a href=\"javascri" +
"pt:wolink('content/lebensph.htm', '12', '', '')\" onMouseO" +
"ut=\"status=''; return true;\" onMouseOver=\"status='Erfol" +
"g und Leben'; return true;\">Erfolg und Leben</a></td> </t" +
"r> <tr> <td class=\"contenttext\">xxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxx</td> <td> </td> <td class=\"contenttext\">xxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxx</td> <td> </td> <td class=\"contenttext\">xx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</td> </tr> <tr> <td colspan=" +
"\"3\" rowspan=\"2\"><a href=\"javascript:openWin('../../co" +
"ntent/web_de/default.htm');\"><img alt=\"\" border=\"0\" s" +
"rc=\"/portal/sh/img2/bm775.gif\"/></a></td>        <td> </" +
"td>        <td> </td> </tr><tr><td> </td><td> </td></tr>
<" +
"tr> <td colspan=\"5\"><img border=\"0\" height=\"1\" src=\"" +
"/portal/sh/gfx/px_darkgrey.gif\" width=\"588\"/></td> </tr>" +
"  <tr> <td colspan=\"5\"><img alt=\"\" border=\"0\" height=" +
"\"7\" src=\"/portal/sh/gfx/spacer.gif\" width=\"1\"/></td> " +
"</tr> <tr> <td colspan=\"5\">Copyright © 2002 <a href=\"/po" +
"rtal/content/impressum.htm?Session=PH2EfbdF7rZu6Vi1Xx9Qxxp6" +
"Ckix2xXxwiDt4g3eeMHKfg2IAtok|8721859357816600716/-145673201" +
"4/6/7001/7001/7002/7002/7001/-1\">xxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxx</a>. xxxxxxxxxxxxxxxxxxxxxxx.<br /> xxxxxxxxxxxxxxxxx" +
"xx <a href=\"/portal/content/rechhinw.htm?Session=PH2EfbdF7" +
"rZu6Vi1Xx9Qxxp6Ckix2xXxwiDt4g3eeMHKfg2IAtok|872185935781660" +
"0716/-1456732014/6/7001/7001/7002/7002/7001/-1\">xxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</a></td> </tr>  </table" +
"><!-- /xxxxxxxxxxxxxxxxxxxxxx --><!-- /xxxxxxxxxxxxxxxxxxxx" +
"xx --></body></html>";

    }
}

--
To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>


Mime
View raw message