You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/06/07 17:22:03 UTC

DO NOT REPLY [Bug 49398] New: ByteChunk.indexOf(String, ...) behaviour with strings of length 1

https://issues.apache.org/bugzilla/show_bug.cgi?id=49398

           Summary: ByteChunk.indexOf(String, ...) behaviour with strings
                    of length 1
           Product: Tomcat 6
           Version: 6.0.26
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: knst.kolinko@gmail.com


There is a bug in implementation of the following method
org.apache.tomcat.util.buf.ByteChunk.indexOf(String src, int srcOff, int
srcLen, int myOff) in 6.0.26 and 5.5.29.

The problem is that the method can not find a string which consists of one
character, as the only successful exit from the method is from inside the loop
that checks the second and subsequent characters.

E.g., to reproduce:
byte[] bytes = "Hello\u00a0world".getBytes("ISO-8859-1");
final int len = bytes.length;
ByteChunk bc = new ByteChunk();
bc.setBytes(bytes, 0, len);
bc.indexOf("o", 0, 1, 5); // returns -1, instead of 7.

A testcase for this was added in r945230 and it was fixed in trunk in r945231

This is not observable without a testcase, because all calls to this method in
the current Tomcat 6.0.26 and 5.5.29 code pass a string of several characters.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49398] ByteChunk.indexOf(String, ...) behaviour with strings of length 1

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49398

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> 2010-06-07 11:42:15 EDT ---
Fixed in 5.5 and 6.0, will be in 5.5.30, 6.0.27.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org