[Boost-bugs] [Boost C++ Libraries] #2929: boost::function cause runtime stack overflow

Subject: [Boost-bugs] [Boost C++ Libraries] #2929: boost::function cause runtime stack overflow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-04-09 09:13:55


#2929: boost::function cause runtime stack overflow
---------------------------------------------------+------------------------
 Reporter: Dmitriy Iassenev <iassenev_at_[hidden]> | Owner: dgregor
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: function
  Version: Boost 1.38.0 | Severity: Showstopper
 Keywords: boost function stack overflow |
---------------------------------------------------+------------------------
 the bug described below is presented in all the boost versions starting
 from 1.36 and to development trunk

 {{{
 #include <boost/function.hpp>

 void main()
 {
         boost::function<void () > f( &main );
         boost::function<void () > g;
         g.assign ( f, std::allocator<int>() );
 }

 }}}

 this code sample being compiled under MSVC 8.0 SP1 give the following
 warning

 warning C4717:
 'boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >' : recursive on all control paths,
 function will cause runtime stack overflow

 if we run the sample, it does cause stack overflow with the following call
 stack:



         ...

 test_boost.exe!boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >(const
 boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > & __that={...}) + 0x39 bytes C++

 test_boost.exe!boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >(const
 boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > & __that={...}) + 0x39 bytes C++

 test_boost.exe!std::_Construct<boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int>
>,boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >
>(boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > * _Ptr=0x00185008, const
 boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > & _Val={...}) Line 53 + 0x33 bytes
 C++

 test_boost.exe!std::allocator<boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> >
>::construct(boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > * _Ptr=0x00185008, const
 boost::detail::function::functor_wrapper<boost::function<void
 __cdecl(void)>,std::allocator<int> > & _Val={...}) Line 156 + 0xd bytes
 C++

 test_boost.exe!boost::detail::function::basic_vtable0<void>::assign_functor_a<boost::function<void
 __cdecl(void)>,std::allocator<int> >(boost::function<void __cdecl(void)>
 f={...}, boost::detail::function::function_buffer & functor={...},
 std::allocator<int> a={...}, boost::mpl::bool_<0> __formal={...}) Line
 591 + 0x60 bytes C++

 test_boost.exe!boost::detail::function::basic_vtable0<void>::assign_to_a<boost::function<void
 __cdecl(void)>,std::allocator<int> >(boost::function<void __cdecl(void)>
 f={...}, boost::detail::function::function_buffer & functor={...},
 std::allocator<int> a={...}, boost::detail::function::function_obj_tag
 __formal={...}) Line 615 C++

 test_boost.exe!boost::detail::function::basic_vtable0<void>::assign_to_a<boost::function<void
 __cdecl(void)>,std::allocator<int> >(boost::function<void __cdecl(void)>
 f={...}, boost::detail::function::function_buffer & functor={...},
 std::allocator<int> a={...}) Line 497 + 0x47 bytes C++

 test_boost.exe!boost::function0<void>::assign_to_a<boost::function<void
 __cdecl(void)>,std::allocator<int> >(boost::function<void __cdecl(void)>
 f={...}, std::allocator<int> a={...}) Line 949 + 0x3d bytes C++

         test_boost.exe!boost::function0<void>::assign<boost::function<void
 __cdecl(void)>,std::allocator<int> >(boost::function<void __cdecl(void)>
 f={...}, std::allocator<int> a={...}) Line 802 + 0x34 bytes C++


         test_boost.exe!main() Line 8 C++

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2929>
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:00 UTC