| Anonymous | Login | Signup for a new account | 12-18-2025 01:08 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0005807 | [Resin] | minor | always | 10-01-14 17:24 | 10-01-14 17:24 | ||||
| Reporter | nam | View Status | public | ||||||
| Assigned To | nam | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | 4.0.41 | ||||||
| Summary | 0005807: AbstractHttpResponse.setHeader(-1) throws IllegalArgumentException | ||||||||
| Description |
(rep by stegard) This works fine: response.setContentLength(-1); However, we are encountering a Resin exception when the following is called: response.setHeader("Content-Length", "-1"); (IllegalArgumentException with message "-1 is an invalid content-length".) Looks like AbstractHttpResponse#parseLong has an error in it with numbers prefixed with either "+" or "-". Propose the following patch (Resin 4.0.41): --- AbstractHttpResponse.java.orig 2014-10-01 22:47:03.133607270 +0200 +++ AbstractHttpResponse.java 2014-10-01 22:47:30.241607757 +0200 @@ -572,11 +572,11 @@ sign = -1; if (i < length) - ch = string.charAt(i++); + ch = string.charAt(++i); } else if (ch == '+') { if (i < length) - ch = string.charAt(i++); + ch = string.charAt(++i); } if (! ('0' <= ch && ch <= '9')) { ---------------------------------------------------- Added checks to avoid going out of bounds on invalid number input: --- AbstractHttpResponse.java.orig 2014-10-01 22:47:03.133607270 +0200 +++ AbstractHttpResponse.java 2014-10-01 23:06:58.209628739 +0200 @@ -571,12 +571,12 @@ if (ch == '-') { sign = -1; - if (i < length) - ch = string.charAt(i++); + if (i < length-1) + ch = string.charAt(++i); } else if (ch == '+') { - if (i < length) - ch = string.charAt(i++); + if (i < length-1) + ch = string.charAt(++i); } if (! ('0' <= ch && ch <= '9')) { |
||||||||
| Additional Information | |||||||||
| Attached Files | |||||||||
|
|
|||||||||
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed. 25 unique queries executed. |