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

Bug #1622073 reported by Seth Arnold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zeromq3 (Ubuntu)
Fix Released
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

Revision history for this message
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).

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.