Core/Packets: Changed ByteBuffer write exceptions into asserts (reading is unaffected as data comes from untrusted source - client)

This commit is contained in:
Shauren
2017-01-24 00:08:12 +01:00
parent 7b43adc436
commit c36f831ab7
2 changed files with 19 additions and 49 deletions
+2 -13
View File
@@ -26,28 +26,17 @@ ByteBuffer::ByteBuffer(MessageBuffer&& buffer) : _rpos(0), _wpos(0), _bitpos(Ini
{
}
ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize)
ByteBufferPositionException::ByteBufferPositionException(size_t pos, size_t size, size_t valueSize)
{
std::ostringstream ss;
ss << "Attempted to " << (add ? "put" : "get") << " value with size: "
ss << "Attempted to get value with size: "
<< valueSize << " in ByteBuffer (pos: " << pos << " size: " << size
<< ")";
message().assign(ss.str());
}
ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, size_t valueSize)
{
std::ostringstream ss;
ss << "Attempted to put a "
<< (valueSize > 0 ? "NULL-pointer" : "zero-sized value")
<< " in ByteBuffer (pos: " << pos << " size: " << size << ")";
message().assign(ss.str());
}
void ByteBuffer::print_storage() const
{
if (!sLog->ShouldLog("network", LOG_LEVEL_TRACE)) // optimize disabled trace output