commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31816] New: - Certain EL statements cause an apparant infinite loop in the EL parser.
Date Thu, 21 Oct 2004 00:35:25 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31816>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31816

Certain EL statements cause an apparant infinite loop in the EL parser.

           Summary: Certain EL statements cause an apparant infinite loop in
                    the EL parser.
           Product: Commons
           Version: 1.0 Final
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: EL
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: blenkush@ccs.neu.edu
                CC: blenkush@ccs.neu.edu


The following EL statement causes an apparant infinite loop in the EL parser:

${(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:
toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:toUpperCase(fn:
toUpperCase(fn:toUpperCase('b')))))))))))))))))))))))))))))))))}

This is due to the LOOKAHEAD on line 256 of ELParser.jj

I have an initial fix which allows the EL expression to be parsed quickly but I have not tested

thoroughly. In ELParser.jj delete the grammar production ConditionalExpression() and replace

Expression() and OrExpression() with the below text: 

Expression Expression () :
{
  Expression ret;
}
{
  (
   ret = OrExpression ()
  )
  { return ret; }
}


Expression OrExpression () :
{
  Expression startExpression, condition, trueBranch=null, falseBranch=null;
  BinaryOperator operator;
  Expression expression;
  List operators = null;
  List expressions = null;
}
{
  startExpression = AndExpression ()

    ((
     (
      (<OR1> | <OR2>) { operator = OrOperator.SINGLETON; }
      )
     expression = AndExpression ()

      {
	if (operators == null) {
	  operators = new ArrayList ();
	  expressions = new ArrayList ();
	}
	operators.add (operator);
	expressions.add (expression);
      }
     )*
     (
     <COND>
     trueBranch = Expression ()
     <COLON>
     falseBranch = Expression ()
     )?
    )
  {
    if (operators != null) {
      condition = new BinaryOperatorExpression (startExpression,
					   operators,
					   expressions);
    }
    else {
      condition = startExpression;
    }
    
    if(trueBranch != null)
        return new ConditionalExpression(condition, trueBranch, falseBranch);
    else
        return condition;
  }
}

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


Mime
View raw message