Opened 9 years ago
Last modified 8 years ago
#9666 new Bugs
managed_shared_memory constructor crash
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following code causes a crash on Visual Studio 2013 when compiling for 64-bit and with optimization.
#include <boost/interprocess/managed_shared_memory.hpp> using namespace boost::interprocess; int main() { static const char name[] = "test_shm"; shared_memory_object::remove(name); managed_shared_memory segment(create_only, name, 65536); return 0; }
The reported error is a buffer overrun The crash doesn't happen on 32-bit builds. It also doesn't happen when building without optimization. Finally, it doesn't happen when compiling with /GS- (disable security checks).
This is the stack trace:
msvcr120.dll!__crt_debugger_hook(int _Reserved=1) Line 60 C testshm.exe!__raise_securityfailure(_EXCEPTION_POINTERS * ExceptionPointers=0x000000013fa8c170) Line 70 C testshm.exe!__report_gsfailure(unsigned __int64 StackCookie=63963535653567328) Line 241 C testshm.exe!boost::intrusive::rbtree_algorithms<boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,1> >::rebalance_after_insertion(const boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0> >,__int64,unsigned __int64,0> & header=<struct at NULL>, boost::interprocess::offset_ptr<boost::intrusive::compact_rbtree_node<boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0> >,__int64,unsigned __int64,0> p={...}) Line 528 C++ testshm.exe!boost::intrusive::bstree_impl<boost::intrusive::bhtraits<boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>::block_ctrl,boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,1>,0,boost::intrusive::default_tag,3>,void,unsigned __int64,1,4>::insert_equal(boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>::block_ctrl & value={...}) Line 861 C++ testshm.exe!boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>::priv_add_segment(void * addr=0x0000000050000063, unsigned __int64 segment_size=1374736) Line 426 C++ testshm.exe!boost::interprocess::segment_manager<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>,boost::interprocess::iset_index>::segment_manager<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>,boost::interprocess::iset_index>(unsigned __int64 segment_size=65536) Line 414 C++ testshm.exe!boost::interprocess::ipcdetail::basic_managed_memory_impl<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>,boost::interprocess::iset_index,8>::create_impl(void * addr=0x0000000000000000, unsigned __int64 size=1) Line 176 C++ testshm.exe!boost::interprocess::ipcdetail::managed_open_or_create_impl<boost::interprocess::shared_memory_object,8,1,0>::priv_open_or_create<boost::interprocess::ipcdetail::create_open_func<boost::interprocess::ipcdetail::basic_managed_memory_impl<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>,boost::interprocess::iset_index,8> > >(boost::interprocess::ipcdetail::create_enum_t type=1068023640, const char * const & id=0x00000000000000c2, unsigned __int64 size=8, boost::interprocess::mode_t mode=read_write, const void * addr=0x0000000000000000, const boost::interprocess::permissions & perm={...}, boost::interprocess::ipcdetail::create_open_func<boost::interprocess::ipcdetail::basic_managed_memory_impl<char,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void,__int64,unsigned __int64,0>,0>,boost::interprocess::iset_index,8> > construct_func) Line 407 C++ testshm.exe!main() Line 9 C++ testshm.exe!__tmainCRTStartup() Line 626 C kernel32.dll!BaseThreadInitThunk() Unknown ntdll.dll!RtlUserThreadStart() Unknown
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
This seems solved in current develop and master branches. Could you check this?
Note:
See TracTickets
for help on using tickets.
We are also experiencing what appears to be an identical problem using Boost 1.55 and VS2013, we are also making 64Bit optimised builds when we see this problem. Changing back to Boost 1.51 or using VC10 seems to work fine - Roger