Subject: [Boost-bugs] [Boost C++ Libraries] #3417: boost::interprocess::managed_shared_memory::belongs_to_segment returns incorrect value.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-09-07 21:00:46
#3417: boost::interprocess::managed_shared_memory::belongs_to_segment returns
incorrect value.
-----------------------------------------------+----------------------------
Reporter: Lénaïc Huard <lhuard@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: interprocess
Version: Boost 1.40.0 | Severity: Problem
Keywords: |
-----------------------------------------------+----------------------------
Hello,
It seems that
boost::interprocess::managed_shared_memory::belongs_to_segment
implementation is not correct. It returns true for chunks of memory that
don't belong to the shared memory segment providing it's lying at a higher
address.
Looking at
https://svn.boost.org/trac/boost/browser/trunk/boost/interprocess/detail/managed_memory_impl.hpp
shows:
262
//!Returns true if the address belongs to the managed memory segment
263
bool belongs_to_segment (const void *ptr) const
264
{
265
return ptr >= this->get_address() &&
266
ptr < (reinterpret_cast<const char*>(ptr) +
this->get_size());
267
}
It would be more logical to have:
//!Returns true if the address belongs to the managed memory segment
bool belongs_to_segment (const void *ptr) const
{
return ptr >= this->get_address() &&
ptr < (reinterpret_cast<const char *>(this->get_address()) +
this->get_size());
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3417> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC