summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhammika Pathirana <dhammika@gmail.com>2010-08-27 18:06:37 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-08-27 18:06:37 +0200
commit98dc11843e3234e3d70b50d4f650089e7cf99e63 (patch)
tree75365ee52e70e31c14222c327fe1682db9ec5963
parent56faac7f19bf2a6d2c7b6e0c2e35fcb667a72a48 (diff)
assert on malformed messages
-rw-r--r--src/zmq_decoder.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/zmq_decoder.cpp b/src/zmq_decoder.cpp
index 8e335c9..dcf8e76 100644
--- a/src/zmq_decoder.cpp
+++ b/src/zmq_decoder.cpp
@@ -56,6 +56,9 @@ bool zmq::zmq_decoder_t::one_byte_size_ready ()
// TODO: Handle over-sized message decently.
+ // There has to be at least one byte (the flags) in the message).
+ zmq_assert (*tmpbuf > 0);
+
// in_progress is initialised at this point so in theory we should
// close it before calling zmq_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...
@@ -74,6 +77,10 @@ bool zmq::zmq_decoder_t::eight_byte_size_ready ()
// TODO: Handle over-sized message decently.
+ // There has to be at least one byte (the flags) in the message).
+ zmq_assert (size > 0);
+
+
// in_progress is initialised at this point so in theory we should
// close it before calling zmq_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...