diff options
author | Dhammika Pathirana <dhammika@gmail.com> | 2010-08-27 18:06:37 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-09-04 16:59:25 +0200 |
commit | 10227899b1ccdaecf709fbfc7b765e147baf3080 (patch) | |
tree | 39757f9dd5599e9dee0d3ca0147c82bd2b8b8073 /src | |
parent | c2f3b3b4458187085e148850068f9719c2567614 (diff) |
assert on malformed messages
Diffstat (limited to 'src')
-rw-r--r-- | src/zmq_decoder.cpp | 7 |
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... |