summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/BasicStream.h3
-rw-r--r--cpp/include/Ice/Exception.h1
-rw-r--r--cpp/src/Ice/BasicStream.cpp6
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp3
-rw-r--r--cpp/src/Ice/ConnectionI.cpp3
-rw-r--r--cpp/src/Ice/Exception.cpp8
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp2
-rw-r--r--cpp/src/Ice/ThreadPool.cpp2
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp2
-rw-r--r--cpp/src/IceSSL/TransceiverI.cpp2
10 files changed, 18 insertions, 14 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
index 0af2a36fffc..2bd59ec884d 100644
--- a/cpp/include/Ice/BasicStream.h
+++ b/cpp/include/Ice/BasicStream.h
@@ -109,7 +109,7 @@ public:
//
if(!_unlimited && sz > _messageSizeMax)
{
- throwMemoryLimitException(__FILE__, __LINE__);
+ IceInternal::Ex::throwMemoryLimitException(__FILE__, __LINE__, sz, _messageSizeMax);
}
b.resize(sz);
@@ -629,7 +629,6 @@ private:
// ordering.
//
void throwUnmarshalOutOfBoundsException(const char*, int);
- void throwMemoryLimitException(const char*, int);
void throwNegativeSizeException(const char*, int);
void throwUnsupportedEncodingException(const char*, int, Ice::Byte, Ice::Byte);
void throwEncapsulationException(const char*, int);
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h
index b7c476dd3af..7a760401dd1 100644
--- a/cpp/include/Ice/Exception.h
+++ b/cpp/include/Ice/Exception.h
@@ -23,6 +23,7 @@ namespace Ex
{
ICE_API void throwUOE(const ::std::string&, const ::std::string&);
+ICE_API void throwMemoryLimitException(const char*, int, size_t, size_t);
}
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index e1a475f8ee1..069d6ddee52 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -2119,12 +2119,6 @@ IceInternal::BasicStream::throwUnmarshalOutOfBoundsException(const char* file, i
}
void
-IceInternal::BasicStream::throwMemoryLimitException(const char* file, int line)
-{
- throw MemoryLimitException(file, line);
-}
-
-void
IceInternal::BasicStream::throwNegativeSizeException(const char* file, int line)
{
throw NegativeSizeException(file, line);
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index 7066e8eb84e..5953691c640 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -173,7 +173,8 @@ ConnectRequestHandler::finishBatchRequest(BasicStream* os)
if(!_batchAutoFlush &&
_batchStream.b.size() + _batchRequestsSize > _reference->getInstance()->messageSizeMax())
{
- throw Ice::MemoryLimitException(__FILE__, __LINE__);
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, _batchStream.b.size() + _batchRequestsSize,
+ _reference->getInstance()->messageSizeMax());
}
_batchRequestsSize += _batchStream.b.size();
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 224fbf3c902..399351f2b0f 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -722,7 +722,8 @@ Ice::ConnectionI::finishBatchRequest(BasicStream* os, bool compress)
//
if(sizeof(requestBatchHdr) + lastRequest.size() > _instance->messageSizeMax())
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, sizeof(requestBatchHdr) + lastRequest.size(),
+ _instance->messageSizeMax());
}
//
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 01778f4d7f9..35a14621375 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -32,6 +32,14 @@ throwUOE(const string& expectedType, const string& actualType)
actualType, expectedType);
}
+void
+throwMemoryLimitException(const char* file, int line, size_t requested, size_t maximum)
+{
+ ostringstream s;
+ s << "requested " << requested << " bytes, maximum allowed is " << maximum << " bytes (see Ice.MessageSizeMax)";
+ throw Ice::MemoryLimitException(file, line, s.str());
+}
+
}
}
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index 17564a93bd3..8089d5e4a9b 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -275,7 +275,7 @@ IceInternal::TcpTransceiver::checkSendSize(const Buffer& buf, size_t messageSize
{
if(buf.b.size() > messageSizeMax)
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax);
}
}
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 63fc22a7f11..7f0e0254e56 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -730,7 +730,7 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
}
if(size > static_cast<Int>(_instance->messageSizeMax()))
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, size, _instance->messageSizeMax());
}
if(size > static_cast<Int>(stream.b.size()))
{
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 12b31236281..7df567b654e 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -271,7 +271,7 @@ IceInternal::UdpTransceiver::checkSendSize(const Buffer& buf, size_t messageSize
{
if(buf.b.size() > messageSizeMax)
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax);
}
const int packetSize = min(_maxPacketSize, _sndSize - _udpOverhead);
if(packetSize < static_cast<int>(buf.b.size()))
diff --git a/cpp/src/IceSSL/TransceiverI.cpp b/cpp/src/IceSSL/TransceiverI.cpp
index 9cbde9975b4..07c3932544d 100644
--- a/cpp/src/IceSSL/TransceiverI.cpp
+++ b/cpp/src/IceSSL/TransceiverI.cpp
@@ -499,7 +499,7 @@ IceSSL::TransceiverI::checkSendSize(const IceInternal::Buffer& buf, size_t messa
{
if(buf.b.size() > messageSizeMax)
{
- throw MemoryLimitException(__FILE__, __LINE__);
+ IceInternal::Ex::throwMemoryLimitException(__FILE__, __LINE__, buf.b.size(), messageSizeMax);
}
}