activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Schlapfer (JIRA)" <>
Subject [jira] Commented: (AMQCPP-235) UTF8 length marshalling bug in openwire readString and writeString.
Date Mon, 20 Apr 2009 22:43:31 GMT


Martin Schlapfer commented on AMQCPP-235:


Great job.  I like that you refactored the string utf8 marshalling into the Data[Input|Output]Stream
class to align with Java and used the OpenwireStringSupport class to handle the large string
utf8 marshalling.  You also used modified utf8 encoding, very nice.

Ideally the utf8 marshalling code could be contained in one spot regardless of integer (large
string) or unsigned short length.  This would avoid code duplication in the two locations
and thus less chance for a bug to be introduced at some later point.  One could do this, for
example, by writing or reading the integer or unsigned short length accordingly, and then
using a common piece of code to write / read the utf8 encoding.  That's my only comment.

Looks great!


> UTF8 length marshalling bug in openwire readString and writeString.
> -------------------------------------------------------------------
>                 Key: AMQCPP-235
>                 URL:
>             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,
> 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.

View raw message