You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Rick Hobbs (JIRA)" <ji...@apache.org> on 2007/08/22 16:23:22 UTC
[jira] Created: (AMQCPP-141) ActiveMQTextMessage::getText() causes
an index out of bounds assertion failure if trying to read a 0 length text
message
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: Nathan Mittler
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.
[jira] Resolved: (AMQCPP-141) ActiveMQTextMessage::getText() causes
an index out of bounds assertion failure if trying to read a 0 length text
message
Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Assigned: (AMQCPP-141) ActiveMQTextMessage::getText() causes
an index out of bounds assertion failure if trying to read a 0 length text
message
Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/AMQCPP-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish reassigned AMQCPP-141:
-----------------------------------
Assignee: Timothy Bish (was: Nathan Mittler)
> 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
> 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.
[jira] Updated: (AMQCPP-141) ActiveMQTextMessage::getText() causes
an index out of bounds assertion failure if trying to read a 0 length text
message
Posted by "Nathan Mittler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/AMQCPP-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathan Mittler updated AMQCPP-141:
----------------------------------
Fix Version/s: (was: 2.2)
2.1.1
> 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.1.1
>
> 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.