[ 
https://issues.apache.org/activemq/browse/AMQCPP-235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timothy Bish resolved AMQCPP-235.
---------------------------------

    Resolution: Fixed

Fixed in trunk and in the 2.x branch.

The DataInput/OutputStream's have been modified to correctly write and read 
modified UTF-8 using the normal Java standard which encodes the length as an 
unsigned short value limiting the length to 65535 encoded bytes.  The 
OpenWireStringSupport class has been modified to correctly read and write 
modified UTF-8 that encode the length as a signed integer which removes 
limitations previously set on the length of properties in the Messages to 65535 
encoded bytes.  The ActiveMQTextMessage has been modified to also use the 
OpenWireString support Method instead of its own version of the code so now all 
text should properly encode ASCII values from 0-255.

Enhanced unit tests have also been added. 

You are welcome to review the code and comment.

> UTF8 length marshalling bug in openwire readString and writeString.
> -------------------------------------------------------------------
>
>                 Key: AMQCPP-235
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-235
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Openwire
>         Environment: Windows XP / Visual Studio 2005
>            Reporter: Martin Schlapfer
>            Assignee: Timothy Bish
>            Priority: Minor
>             Fix For: 2.2.6, 3.0
>
>         Attachments: OpenwireStringSupport.cpp.patch, 
> OpenwireStringSupportTest.cpp.patch, OpenwireStringSupportTest.h.patch
>
>
> In investigating a bug for the check "if( str->size() > 65536 )" which should 
> be "if( str->size() > 65535 )" in writeString() , I found a couple of other 
> problems:
> (1) The OpenwireStringSupport::readString method should read the utf8 length 
> as an unsigned short rather than short.  The problem is that utf8 encoded 
> strings (using writeString) longer than 32768 will become truncated when read 
> back using readString().
> (2) The writeString() method should also check the value of utflen after 
> determining the UTF8 length of the encoded string, since with the support of 
> characters greater than value 127, encodings of 2 UTF8 bytes per byte can 
> exist.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to