Check decoder's state function for NULL before calling it

Fixes bug reported by Peter Friend
(http://lists.zeromq.org/pipermail/zeromq-dev/2012-November/019425.html)
This commit is contained in:
Martin Hurton 2012-11-21 22:50:55 +01:00
parent 8db8c45b18
commit a8721c3c04

View File

@ -148,6 +148,10 @@ namespace zmq
// False is returned if the decoder has encountered an error.
bool stalled ()
{
// Check whether there was decoding error.
if (unlikely (static_cast <T*> (this)->next == NULL))
return false;
while (!to_read) {
if (!(static_cast <T*> (this)->*next) ()) {
if (unlikely (!(static_cast <T*> (this)->next)))