[zeromq-dev] crash in send_unsubscription

Blinova, Katerina kblinova at dolby.com
Thu Apr 11 20:41:54 CEST 2013


Hi,

I am learning zeroMQ and have implemented simple XSUB/XPUB proxy as outlined in the guide.

I have a SUB client that consumes 10 messages and exits. When that happens, there is a crash in XSUB/XPUB zmq_proxy function on the line highlighted below.
Has anybody else seen this and is this a bug that should be fixed? The data is NULL and size_ is 0.

void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
    void *arg_)
{
    xpub_t *self = (xpub_t*) arg_;

    if (self->options.type != ZMQ_PUB) {

              //  Place the unsubscription to the queue of pending (un)sunscriptions
              //  to be retrived by the user later on.
              blob_t unsub (size_ + 1, 0);
              unsub [0] = 0;
              if (size_ > 0)  <<---- Added check to prevent crash
                     memcpy (&unsub [1], data_, size_); <<-----------------
              self->pending.push_back (unsub);
    }
}


Thanks,

Katerina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130411/d3e546cf/attachment.htm>


More information about the zeromq-dev mailing list