Boost logo

Boost-Commit :

From: igaztanaga_at_[hidden]
Date: 2007-09-21 16:45:15


Author: igaztanaga
Date: 2007-09-21 16:45:14 EDT (Fri, 21 Sep 2007)
New Revision: 39464
URL: http://svn.boost.org/trac/boost/changeset/39464

Log:
Glenn Schrader patch: Segmentation fault with 1.34+ on Linux x86_64.
Reason: The ~ only complemented the 32 bit unsigned value. When the value was expanded into a size_t the value isn't sign extended so the upper 32 bits wind up being zero. Since this is used as an address mask the upper half of the address is zeroed.
Text files modified:
   trunk/boost/interprocess/offset_ptr.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/interprocess/offset_ptr.hpp
==============================================================================
--- trunk/boost/interprocess/offset_ptr.hpp (original)
+++ trunk/boost/interprocess/offset_ptr.hpp 2007-09-21 16:45:14 EDT (Fri, 21 Sep 2007)
@@ -384,7 +384,7 @@
    typedef boost::interprocess::offset_ptr<T> pointer;
 
    static pointer get_pointer(const pointer &n)
- { return (T*)(std::size_t(n.get()) & std::size_t(~2u)); }
+ { return (T*)(std::size_t(n.get()) & ~std::size_t(2u)); }
 
    static void set_pointer(pointer &n, pointer p)
    { n = (T*)(std::size_t(p.get()) | (std::size_t(n.get()) & std::size_t(2u))); }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk