From e3b7e6abd6b203e1853ec64d365a6484399e4a72 Mon Sep 17 00:00:00 2001 From: Maksim Kuzevanov Date: Fri, 1 Jul 2016 11:11:29 +0300 Subject: [PATCH] fix undefined behaviour due to a reference to a destroyed temporary object --- src/connectionimpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connectionimpl.cpp b/src/connectionimpl.cpp index 29da84e..9fbf4c7 100644 --- a/src/connectionimpl.cpp +++ b/src/connectionimpl.cpp @@ -123,7 +123,8 @@ uint64_t ConnectionImpl::parse(const Buffer &buffer) try { // try to recognize the frame - ReceivedFrame receivedFrame(ReducedBuffer(buffer, processed), _maxFrame); + ReducedBuffer reduced_buf(buffer, processed); + ReceivedFrame receivedFrame(reduced_buf, _maxFrame); // do we have the full frame? if (receivedFrame.complete())