summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/FieldTable.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-08-24 14:27:24 +0000
committerGordon Sim <gsim@apache.org>2011-08-24 14:27:24 +0000
commitc811fa4c2181f7dbb90a3d937852463cb351bdb0 (patch)
treedd935fa1a7be54db242d7b9c21cb9659796b6441 /cpp/src/qpid/framing/FieldTable.cpp
parentf773ec7c99d1401b33761b11c9a421e0d44c9450 (diff)
downloadqpid-python-c811fa4c2181f7dbb90a3d937852463cb351bdb0.tar.gz
QPID-3445: Added some extra checks to decode logic; consolidated exception handling for message decode. Patch from Paul Colby.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1161119 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/FieldTable.cpp')
-rw-r--r--cpp/src/qpid/framing/FieldTable.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpp/src/qpid/framing/FieldTable.cpp b/cpp/src/qpid/framing/FieldTable.cpp
index 21eaea0f4d..f80d2f9fb1 100644
--- a/cpp/src/qpid/framing/FieldTable.cpp
+++ b/cpp/src/qpid/framing/FieldTable.cpp
@@ -198,10 +198,12 @@ void FieldTable::encode(Buffer& buffer) const {
void FieldTable::decode(Buffer& buffer){
clear();
+ if (buffer.available() < 4)
+ throw IllegalArgumentException(QPID_MSG("Not enough data for field table."));
uint32_t len = buffer.getLong();
if (len) {
uint32_t available = buffer.available();
- if (available < len)
+ if ((available < len) || (available < 4))
throw IllegalArgumentException(QPID_MSG("Not enough data for field table."));
uint32_t count = buffer.getLong();
uint32_t leftover = available - len;