}
if (messageSize > m_bufferSize)
- ReserveMessageSize(messageSize);
-
+ {
+ try{
+ ReserveMessageSize(messageSize);
+ } catch (const std::bad_alloc &e) {
+ LogError("Bad allocation while realloc: " << e.what());
+ return InputResult::ProtocolBroken;
+ }
+ }
return InputResult::Pending;
}
auto payloadSize = *reinterpret_cast<size_t*>(m_buffer);
if (payloadSize > m_bufferSize)
- ReserveMessageSize(payloadSize);
-
+ {
+ try{
+ ReserveMessageSize(payloadSize);
+ } catch (const std::bad_alloc &e) {
+ LogError("Bad allocation while realloc: " << e.what());
+ return 0;
+ }
+ }
return payloadSize;
}
private: