Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1387

apache2_stream_read function ignores errors from ap_get_client_block is size_t is unsigned

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.6.0
    • 1.7.0
    • httpd module
    • None
    • CentOS 5.3
      httpd-2.2.3
      rampartc-1.3.0
      dell precision desktop

    Description

      This problem has only been noticed when attempting to decompress input streams via apache.

      The problem occurs when a decompression payload fails to decompress properly. In my test case it was because the payload had some flags set in the gzip headers and mod_deflate doesn't support flags. mod_deflate then returned an APR_EGENERAL error message. This message then bubbled up and was returned as a -1 to apache2_stream_read.

      This is a problem because size_t, on my system, is unsigned. The checks in apache2_stream_read fail to catch a negative value in this scenario and dont respond appropriately.

      while (count - len > 0)
      {
      read = ap_get_client_block(stream_impl->request, (char *)buffer + len, count - len);
      if (read > 0)

      { len += read; }

      else

      { break; }

      }

      The else statement will never get reached while read is unsigned. Also, the while loop might have troubles as well. I would suggest modifying read and len to be ssize_t so they match the return value of ap_get_client_block.

      If I get this modified and working, I will submit a patch.

      Attachments

        Activity

          People

            nandika Korale Gamaralalage Nandika Chandrasiri Jayawardana
            murfito Murph McCloy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified