Fixed wrong buffer end detection in v2_decoder.

zero-copy msg_t::init cannot be used when the message exceeds either
the buffer end or the last received byte. To detect this, the buffer
is now resized to the numnber of received bytes.
This commit is contained in:
Jens Auer
2015-06-10 22:09:55 +02:00
parent b3f2acf7d6
commit dfe1908008
6 changed files with 29 additions and 2 deletions

View File

@@ -80,9 +80,16 @@ namespace zmq
return buf;
}
void resize(size_t new_size)
{
bufsize = new_size;
}
private:
unsigned char* buf;
size_t bufsize;
size_t maxsize;
zmq::atomic_counter_t* msg_refcnt;
};
// Decoder for ZMTP/2.x framing protocol. Converts data stream into messages.