diff options
author | Chris Wilson <chris+github@qwirx.com> | 2012-01-22 16:39:12 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2012-01-22 16:39:12 +0000 |
commit | 2d6a0626b6e384bc160db3def77f5ca6b29ee8d3 (patch) | |
tree | 92f425782aa351161bdcef76b937bf5afa469364 /lib/server/Protocol.cpp | |
parent | 627f2f8ccd0208a735a46cf4d9960fd3e0eb2f7c (diff) |
Catch trying to send a zero-length stream, which will cause an assertion failure on the other side.
Diffstat (limited to 'lib/server/Protocol.cpp')
-rw-r--r-- | lib/server/Protocol.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/server/Protocol.cpp b/lib/server/Protocol.cpp index 82836007..382f1c37 100644 --- a/lib/server/Protocol.cpp +++ b/lib/server/Protocol.cpp @@ -688,6 +688,17 @@ void Protocol::SendStream(IOStream &rStream) // 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); |