[Box Backup-commit] COMMIT r3069 - box/trunk/lib/server

subversion at boxbackup.org subversion at boxbackup.org
Sun Jan 22 16:39:12 GMT 2012


Author: chris
Date: 2012-01-22 16:39:12 +0000 (Sun, 22 Jan 2012)
New Revision: 3069

Modified:
   box/trunk/lib/server/Protocol.cpp
Log:
Catch trying to send a zero-length stream, which will cause an assertion failure on the other side.


Modified: box/trunk/lib/server/Protocol.cpp
===================================================================
--- box/trunk/lib/server/Protocol.cpp	2012-01-22 16:36:27 UTC (rev 3068)
+++ box/trunk/lib/server/Protocol.cpp	2012-01-22 16:39:12 UTC (rev 3069)
@@ -688,6 +688,17 @@
 		// Can't send this using the fixed size header
 		uncertainSize = true;
 	}
+
+	if(streamSize == 0)
+	{
+		// Server protocol will throw an assertion failure if we
+		// try to send a stream whose size is definitely zero:
+		// ASSERT FAILED: [BytesToRead > 0] at PartialReadStream.cpp:31
+		// so catch this on the client side to help debugging
+		THROW_EXCEPTION_MESSAGE(ServerException, Protocol_BadUsage,
+			"Sending a stream with a definite size of zero "
+			"is not allowed in the protocol");
+	}
 	
 	// Inform sub class
 	InformStreamSending(streamSize);




More information about the Boxbackup-commit mailing list