activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r922428 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp
Date Fri, 12 Mar 2010 21:15:00 GMT
Author: tabish
Date: Fri Mar 12 21:15:00 2010
New Revision: 922428

URL: http://svn.apache.org/viewvc?rev=922428&view=rev
Log:
Fix for: https://issues.apache.org/activemq/browse/AMQCPP-261

Add a couple extra error checks for size overruns on Marshal

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp?rev=922428&r1=922427&r2=922428&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp
Fri Mar 12 21:15:00 2010
@@ -63,6 +63,13 @@ void MarshallingSupport::writeString16( 
     try{
 
         std::size_t strSize = value.length();
+
+        if( strSize > (std::size_t)Short::MAX_VALUE ) {
+            throw IOException(
+                __FILE__, __LINE__,
+                "String size exceeds Short::MAX_VALUE and cannot be sent via Openwire." );
+        }
+
         dataOut.writeShort( (short)strSize );
         if( strSize > 0 ) {
             dataOut.write( (unsigned char*)value.c_str(), strSize, 0, strSize );
@@ -78,7 +85,15 @@ void MarshallingSupport::writeString32( 
     throw( decaf::io::IOException ) {
 
     try{
+
         std::size_t strSize = value.length();
+
+        if( strSize > (std::size_t)Integer::MAX_VALUE ) {
+            throw IOException(
+                __FILE__, __LINE__,
+                "String size exceeds Integer::MAX_VALUE and cannot be sent via Openwire."
);
+        }
+
         dataOut.writeInt( (int)strSize );
         if( strSize > 0 ) {
             dataOut.write( (unsigned char*)value.c_str(), strSize, 0, strSize );



Mime
View raw message