diff --git a/src/v2_decoder.cpp b/src/v2_decoder.cpp index 839be9a..37889bd 100644 --- a/src/v2_decoder.cpp +++ b/src/v2_decoder.cpp @@ -116,7 +116,7 @@ int zmq::v2_decoder_t::size_ready (uint64_t msg_size, if (unlikely ( !zero_copy - || ((unsigned char *) read_pos + msg_size > (data () + size ())))) { + || (msg_size > (size_t) (data () + size () - read_pos)))) { // a new message has started, but the size would exceed the pre-allocated arena // this happens every time when a message does not fit completely into the buffer rc = in_progress.init_size (static_cast (msg_size));