zmq::mechanism_t::socket_type_string off-by-one

Bug #1622073 reported by Seth Arnold on 2016-09-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zeromq3 (Ubuntu)
Undecided
Unassigned

Bug Description

Hello, the zmq::mechanism_t::socket_type_string function in ./src/mechanism.cpp appears to have an off-by-one mistake:

const char *zmq::mechanism_t::socket_type_string (int socket_type) const
{
    static const char *names [] = {"PAIR", "PUB", "SUB", "REQ", "REP",
                                   "DEALER", "ROUTER", "PULL", "PUSH",
                                   "XPUB", "XSUB", "STREAM"};
    zmq_assert (socket_type >= 0 && socket_type <= 10);
    return names [socket_type];
}

names[11] is "STREAM" but that triggers the assert.

Thanks

Luca Boccassi (bluca) wrote :

Hi,

Good catch!

This is fixed in 4.2.0 already, and I will fix it for the next 4.1 stable release (4.1.7).

Amr Ibrahim (amribrahim1987) wrote :

Fixed in Zesty.

Changed in zeromq3 (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers