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

JSONOMBuilder drives system to an indefinite loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.5.5
    • 1.6.3, 1.7.0
    • json
    • Mac OS X 10.6.8, JVM 1.6.0_26

    Description

      processDocument method in JSONOMBuilder has the following loop:

      char temp = inputStream.read();
      while (temp != ':') {
      ...
      }

      This will lead to an indefinite loop in case a non-json or empty json {} payload is posted to the servlet. Actually any payload without colon character ':' should reproduce the same problem.

      I fixed it by changing the variable type temp into int and checking if the stream has more elements as a guard condition.

      int temp = inputStream.read();
      while (temp > -1 && temp != ':') {
      if (temp != ' ' && temp != '{')

      { localName += (char)temp; }

      temp = inputStream.read();
      }

      Attachments

        1. JsonService.java
          0.3 kB
          Nadeeshani Hewage
        2. services.xml
          0.3 kB
          Nadeeshani Hewage
        3. Client.java
          2 kB
          Nadeeshani Hewage
        4. jsonEmptyStringInfiniteLoop.patch
          2 kB
          Shameera
        5. JsonInfinteLoop&JSONOMBuilderTest.patch
          5 kB
          Shameera

        Issue Links

          Activity

            People

              shameera Shameera
              invisibleink Han Gun
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: