From f83677056891e436bf5ba99e79240df2a44528cd Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Fri, 21 Oct 2011 14:42:12 +0000 Subject: Merged out from trunk git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/FieldTable.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid/framing/FieldTable.cpp') diff --git a/cpp/src/qpid/framing/FieldTable.cpp b/cpp/src/qpid/framing/FieldTable.cpp index 023e4af819..f80d2f9fb1 100644 --- a/cpp/src/qpid/framing/FieldTable.cpp +++ b/cpp/src/qpid/framing/FieldTable.cpp @@ -129,7 +129,7 @@ FieldTable::ValuePtr FieldTable::get(const std::string& name) const namespace { template T default_value() { return T(); } template <> int default_value() { return 0; } - template <> uint64_t default_value() { return 0; } + //template <> uint64_t default_value() { return 0; } } template @@ -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; -- cgit v1.2.1