From 4d05ce8738a24f3abd9e363a93634538243af1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 28 Mar 2017 12:37:22 +0200 Subject: [PATCH 1/2] Fix for Ticket #12915: "Buffer overflow in boost::container::vector (affects flat_set)" --- include/boost/container/vector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 7456ee8..336d616 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -2257,7 +2257,7 @@ class vector boost::uintptr_t const capaddr = boost::uintptr_t(this->priv_raw_begin() + c); boost::uintptr_t const aligned_addr = (addr + szt_align_mask) & ~szt_align_mask; indexes = reinterpret_cast(aligned_addr); - std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - addr)/sizeof(size_type); + std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - aligned_addr)/sizeof(size_type); //Capacity is constant, we're not going to change it if(index_capacity < PosCount){ From 99488659ec0040d9fbd3cb09e24103293143b8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 28 Mar 2017 12:51:33 +0200 Subject: [PATCH 2/2] Update changelog with ticket #12915 --- doc/container.qbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index 341c16c..ebd0ead 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1217,10 +1217,10 @@ use [*Boost.Container]? There are several reasons for that: [section:release_notes_boost_1_64_00 Boost 1.64 Release] * Fixed bugs: - * [@https://svn.boost.org/trac/boost/ticket/12749 Trac #12749: ['"container::pmr::polymorphic_allocator compilation error"]]. * [@https://svn.boost.org/trac/boost/ticket/11333 Trac #11333: ['"boost::basic_string_ref should interop with boost::container::basic_string"]]. + * [@https://svn.boost.org/trac/boost/ticket/12749 Trac #12749: ['"container::pmr::polymorphic_allocator compilation error"]]. + * [@https://svn.boost.org/trac/boost/ticket/12915 Trac #12915: ['"Buffer overflow in boost::container::vector (affects flat_set)"]]. * [@https://github.com/boostorg/container/pull/45 GitHub #45: ['"emplace_back must return reference to back(), not to *end()"]]. - [endsect] [section:release_notes_boost_1_63_00 Boost 1.63 Release]