Author: aconway
Date: Fri Apr 4 07:42:36 2008
New Revision: 644727
URL: http://svn.apache.org/viewvc?rev=644727&view=rev
Log:
src/qpid/amqp_0_10/Assembly.cpp,.h:
- remove unused class.
src/qpid/Serializer.h, src/qpid/amqp_0_10/Map.h:
- Enforce map Size limits using serializer.
Removed:
incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Assembly.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Assembly.h
Modified:
incubator/qpid/trunk/qpid/cpp/src/Makefile.am
incubator/qpid/trunk/qpid/cpp/src/qpid/Serializer.h
incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Map.h
Modified: incubator/qpid/trunk/qpid/cpp/src/Makefile.am
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/Makefile.am?rev=644727&r1=644726&r2=644727&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/src/Makefile.am Fri Apr 4 07:42:36 2008
@@ -115,8 +115,6 @@
qpid/amqp_0_10/Segment.h \
qpid/amqp_0_10/Segment.cpp \
qpid/amqp_0_10/SerializableString.h \
- qpid/amqp_0_10/Assembly.h \
- qpid/amqp_0_10/Assembly.cpp \
qpid/amqp_0_10/Map.h \
qpid/amqp_0_10/Map.cpp \
qpid/amqp_0_10/UnknownType.h \
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/Serializer.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/Serializer.h?rev=644727&r1=644726&r2=644727&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/Serializer.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/Serializer.h Fri Apr 4 07:42:36 2008
@@ -22,6 +22,7 @@
*
*/
+#include <limits>
#include <algorithm>
#include "qpid/Exception.h" // FIXME aconway 2008-04-03: proper exception
class.
@@ -101,6 +102,12 @@
return l;
}
+ /** Get the max number of bytes that can be processed under the
+ * current limit.
+ */
+ size_t getLimit() const {
+ return limit - bytes;
+ }
/** Set absolute limit. */
void setAbsLimit(size_t n) {
limit = n;
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Map.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Map.h?rev=644727&r1=644726&r2=644727&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Map.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Map.h Fri Apr 4 07:42:36
2008
@@ -164,18 +164,17 @@
}
template <class S> void Map::decode(S& s) {
- uint32_t cSize /*, count*/;
+ uint32_t decodedSize /*, count*/;
// FIXME aconway 2008-04-03: replace preview mapping with 0-10 mapping:
// s(contentSize())(uint32_t(size())); // size, count
- // s(cSize)(count);
- s(cSize);
- typename S::Iterator start = s.pos();
+ // s(decodedSize)(count);
+ s(decodedSize);
+ typename S::ScopedLimit l(s, decodedSize); // Make sure we don't overrun.
// FIXME aconway 2008-04-03: replace preview with 0-10:
// for ( ; count > 0; --count) {
- while (uint32_t(std::distance(start, s.pos())) < cSize) {
+ while (s.getLimit() > 0) {
key_type k; MapValue v;
s(k)(v);
- if (uint32_t(std::distance(start, s.pos())) > cSize) throwInvalidArg();
insert(value_type(k,v));
}
}