From 9120741719d7d842fd430eff3f7c028b060b045a Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Wed, 21 Nov 2012 22:50:55 +0100 Subject: [PATCH] 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) --- src/decoder.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/decoder.hpp b/src/decoder.hpp index ec5410f0..814c3197 100644 --- a/src/decoder.hpp +++ b/src/decoder.hpp @@ -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 (this)->next == NULL)) + return false; + while (!to_read) { if (!(static_cast (this)->*next) ()) { if (unlikely (!(static_cast (this)->next)))