[zeromq-dev] zmq_msg_* functions don't check for message validity
Martin Sustrik
sustrik at 250bpm.com
Mon Apr 11 11:48:09 CEST 2011
Hi Reuben,
> Recently I tracked down a segmentation fault to a zmq_msg_size call on a
> closed message.
> After doing some tests I found that all of the zmq_msg_ functions
> segfault on closed messages,
> and I wonder why those functions don't check for the message validity.
>
> Pieter said that 3.0 added checks for sockets and contexts, so adding to
> the messages as well sounds reasonable.
The problem with zmq_msg_t is that it's on the critical path. The
structure itself is very compact and has no space for a runtime tag.
Also the code dealing with it is highly optimised and presumably should
not do any additonal memory access operations.
However, if there's strong need for this kind of functionality, we can
allow it to be switched on at the compile time, say when --enable-debug
is used.
Martin
More information about the zeromq-dev
mailing list