activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (AMQCPP-141) ActiveMQTextMessage::getText() causes an index out of bounds assertion failure if trying to read a 0 length text message
Date Tue, 28 Aug 2007 19:52:22 GMT

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

Timothy Bish resolved AMQCPP-141.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2

Patch applied.  Thanks.

> ActiveMQTextMessage::getText() causes an index out of bounds assertion failure if trying
to read a 0 length text message
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQCPP-141
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-141
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Openwire
>    Affects Versions: 2.1
>         Environment: Windows XP, Compiled under Visual Studio 2005, Active MQ server
4.1.1, Active MQ java client library 4.1.1
>            Reporter: Rick Hobbs
>            Assignee: Timothy Bish
>             Fix For: 2.2
>
>         Attachments: ActiveMQTextMessage.diff
>
>
> If a client (in this case a java client) sends a TextMessage with an empty string, a
C++ based client will fail when calling getText() on the message.
> The reason for this being that a test is done against the length of the content of the
underlying message as follows:
>  if( getContent().size() < 4 ) (line 49 of main/activemq/connector/openwire/commands/ActiveMQTextMessage.cpp).
> If this test fails it is assumed that the string is 0 length. However, as the length
of the string is written as an 4 byte int at the begining of the content stream this test
never fails. This then causes an exception on line:
> return std::string( (const char*)&getContent()[4], getContent().size()-4 );
> As the "getContent()[4]" will cause an index out of bounds assertion if the string is
0 length.
> The suggested fix would be to change the test on line 49 to:
>  if( getContent().size() <= 4 ) 
> A diff file is included.

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


Mime
View raw message