File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ template <>
5050struct pack <std::vector<bool > > {
5151 template <typename Stream>
5252 msgpack::packer<Stream>& operator ()(msgpack::packer<Stream>& o, const std::vector<bool >& v) const {
53- o.pack_array (v.size ());
53+ uint32_t size = checked_get_container_size (v.size ());
54+ o.pack_array (size);
5455 for (std::vector<bool >::const_iterator it (v.begin ()), it_end (v.end ());
5556 it != it_end; ++it) {
5657 o.pack (static_cast <bool >(*it));
@@ -67,10 +68,11 @@ struct object_with_zone<std::vector<bool> > {
6768 o.via .array .ptr = nullptr ;
6869 o.via .array .size = 0 ;
6970 } else {
70- msgpack::object* p = static_cast <msgpack::object*>(o.zone .allocate_align (sizeof (msgpack::object)*v.size ()));
71- msgpack::object* const pend = p + v.size ();
71+ uint32_t size = checked_get_container_size (v.size ());
72+ msgpack::object* p = static_cast <msgpack::object*>(o.zone .allocate_align (sizeof (msgpack::object)*size));
73+ msgpack::object* const pend = p + size;
7274 o.via .array .ptr = p;
73- o.via .array .size = v. size () ;
75+ o.via .array .size = size;
7476 std::vector<bool >::const_iterator it (v.begin ());
7577 do {
7678 *p = msgpack::object (static_cast <bool >(*it), o.zone );
You can’t perform that action at this time.
0 commit comments