summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/Buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/Buffer.h')
-rw-r--r--cpp/src/qpid/framing/Buffer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/Buffer.h b/cpp/src/qpid/framing/Buffer.h
index 190f736f46..fe33dbd366 100644
--- a/cpp/src/qpid/framing/Buffer.h
+++ b/cpp/src/qpid/framing/Buffer.h
@@ -19,6 +19,7 @@
*
*/
#include "amqp_types.h"
+#include "qpid/Exception.h"
#ifndef _Buffer_
#define _Buffer_
@@ -26,6 +27,8 @@
namespace qpid {
namespace framing {
+struct OutOfBounds : qpid::Exception {};
+
class Content;
class FieldTable;
@@ -36,6 +39,8 @@ class Buffer
uint32_t position;
uint32_t r_position;
+ void checkAvailable(uint32_t count) { if (position + count > size) throw OutOfBounds(); }
+
public:
Buffer(char* data, uint32_t size);