From df7c684dd590526c5f431c6d6460a6086756628d Mon Sep 17 00:00:00 2001 From: Patrick McLean Date: Fri, 27 Jan 2017 17:04:42 -0800 Subject: [PATCH] fix divide by zero in zmq::lb_t::sendpipe This is based on https://github.com/zeromq/zeromq3-x/pull/116/files --- src/lb.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lb.cpp b/src/lb.cpp index 2787739e..c4a69178 100644 --- a/src/lb.cpp +++ b/src/lb.cpp @@ -137,7 +137,9 @@ int zmq::lb_t::sendpipe (msg_t *msg_, pipe_t **pipe_) more = msg_->flags () & msg_t::more? true: false; if (!more) { pipes [current]->flush (); - current = (current + 1) % active; + + if (++current >= active) + current = 0; } // Detach the message from the data buffer.