Opened 11 years ago

Closed 8 years ago

#6507 closed Patches (fixed)

fusion::at missing compile time check and overflows stack

Reported by: Antony Polukhin Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

Here are the test cases:

BOOST_AUTO_TEST_CASE(testing_at_c)
{
    boost::fusion::tuple<int, double> t;
    boost::fusion::at_c<2>(t); // runtime stack overflow
}

BOOST_AUTO_TEST_CASE(testing_at)
{
    boost::fusion::tuple<int, double> t;
    boost::fusion::at<boost::mpl::int_<2> >(t); // runtime stack overflow
}

Can be fixed, by adding:

typedef typename result_of::size<Sequence>::type size_type;
BOOST_STATIC_ASSERT((size_type::value > N::value));
BOOST_STATIC_ASSERT((size_type::value >= 0));

to both fusion::at functions in #include <boost/fusion/sequence/intrinsic/at.hpp> and including

#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/static_assert.hpp>

headers.

Change History (2)

comment:1 by Antony Polukhin, 9 years ago

Type: BugsPatches

comment:2 by Joel de Guzman, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.