Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004819 [Resin] minor always 10-20-11 09:58 10-20-11 11:09
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.24
Summary 0004819: contentLength int vs long
Description (rep by Aaron Freeman)

In AbstractHttpRequest I am seeing that the global variable _contentLength it appropriately a ?long?. Love that. Been a thorn in our side for a long time.

 

However in looking at this method (also inside of AbstractHttpRequest):

 

  protected void setContentLength(CharSegment value)

  {

    int contentLength = 0;

    int ch;

    int i = 0;

 

    int length = value.length();

    for (;

         i < length && (ch = value.charAt(i)) >= '0' && ch <= '9';

         i++) {

      contentLength = 10 * contentLength + ch - '0';

    }

 

    if (i > 0)

      _contentLength = contentLength;

  }

 

The method is internally using an int, so the values get truncated or ?wrapped? to negative values. Internally I believe that method should use a long for the local contentLength variable.

 

This should help prevent HttpRequest from incorrectly throwing this for request larger than 2GB (which is what the user community would see in their logs if they are dumping exceptions):

      throw new com.caucho.server.dispatch.BadRequestException("POST requires content-length");

 
Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
10-20-11 09:58 ferg New Issue
10-20-11 11:09 ferg Assigned To  => ferg
10-20-11 11:09 ferg Status new => closed
10-20-11 11:09 ferg Resolution open => fixed
10-20-11 11:09 ferg Fixed in Version  => 4.0.24


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
26 total queries executed.
24 unique queries executed.
Powered by Mantis Bugtracker