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
commitbbc4fc15a0cd69bb868ee97e1f2aa90c15796eab (patch)
treedd935fa1a7be54db242d7b9c21cb9659796b6441 /cpp/src/qpid/framing/FieldTable.cpp
parentb37021d7808766e4529dd14830be0309c0dfa473 (diff)
downloadqpid-python-bbc4fc15a0cd69bb868ee97e1f2aa90c15796eab.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;