activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1087347 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/commands/ActiveMQBytesMessage.cpp test/activemq/commands/ActiveMQBytesMessageTest.cpp
Date Thu, 31 Mar 2011 15:46:53 GMT
Author: tabish
Date: Thu Mar 31 15:46:53 2011
New Revision: 1087347

URL: http://svn.apache.org/viewvc?rev=1087347&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-359

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp?rev=1087347&r1=1087346&r2=1087347&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
Thu Mar 31 15:46:53 2011
@@ -33,6 +33,7 @@ using namespace activemq::commands;
 using namespace activemq::exceptions;
 using namespace decaf::io;
 using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 using namespace decaf::util;
 using namespace decaf::util::zip;
 
@@ -290,6 +291,10 @@ int ActiveMQBytesMessage::readBytes( uns
     initializeReading();
     try{
 
+        if( length < 0 ) {
+            throw IndexOutOfBoundsException(__FILE__, __LINE__, "Array length given was negative");
+        }
+
         int n = 0;
 
         while( n < length ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp?rev=1087347&r1=1087346&r2=1087347&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
Thu Mar 31 15:46:53 2011
@@ -212,6 +212,12 @@ void ActiveMQBytesMessageTest::testReadB
         for( int i = 0; i < 50; i++ ) {
             CPPUNIT_ASSERT( test[i] == i );
         }
+
+        CPPUNIT_ASSERT_THROW_MESSAGE(
+            "Should have thrown a CMSException",
+            msg.readBytes( test, -1 ),
+            CMSException);
+
     } catch( CMSException& ex ) {
         ex.printStackTrace();
         CPPUNIT_ASSERT( false );



Mime
View raw message