Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5078

Axis takes 100% CPU, infinite loop in the QueryStringParser

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.5
    • 1.5.6, 1.6.1, 1.7.0
    • kernel
    • None
    • Mac, Linux

    Description

      Hi,

      My problem is basically https://issues.apache.org/jira/browse/AXIS2-4736, but since it was closed without the step to reproduce, I've open a new issue, and will give you the code I made to test it.

      Yes it's a malformed URL, but I think it's still an issue.

      public static void main( String[] args )

      { QueryStringParser parser = new QueryStringParser("&gsdfgfds"); parser.search( new ArrayList<String>() ); System.out.println("done"); }

      That being said, what I did is change the next() method by adding a check on the idx:

      public boolean next() {
      int len = queryString.length();
      if (paramEnd == len)

      { return false; }

      paramBegin = paramEnd == 0 ? 0 : paramEnd+1;
      int idx = queryString.indexOf('&', paramBegin);

      if(idx == 0)

      { return false; }

      paramEnd = idx == -1 ? len : idx;
      idx = queryString.indexOf('=', paramBegin);
      paramNameEnd = idx == -1 || idx > paramEnd ? paramEnd : idx;
      paramName = null;
      paramValue = null;
      return true;
      }

      For our current needs it work, might not be the best solution, but for what we had to do it worked pretty well. This also pass the QueryStringParserTest that axis has.

      Attachments

        Activity

          People

            veithen Andreas Veithen
            jducharme Jonathan Ducharme
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: