Closed jeking3 closed 4 years ago
Here is the top function in the call stack (from copy_exception_test.cpp
):
template <class T>
inline
exception_ptr
copy_exception( T const & e )
{
try
{
throw enable_current_exception(e);
}
catch(
... )
{
return current_exception();
}
}
The invocation:
boost::exception_ptr p = boost::copy_exception(err());
Where err
derives from both boost::exception
and std::exception
, meaning throw enable_current_exception(e)
throws err
. And, according to the call stack, that results in UB.
To help me diagnose this, maybe try if either of the following triggers this by itself:
throw err();
or
throw enable_current_exception(err());
There is a UBSAN configuration in the current Boost Exception tests. If this is still an issue, is it possible to submit a PR which demonstrates the problem on Travis? Please feel free to reopen.
Following something seen during a CI PR preflight upgrade in Boost.Algorithm, I decided to apply the same CI PR to my fork of Boost.Exception, and we're seeing the same issues. No analysis has been done on the observed failures.
Build command:
UBSAN_OPTIONS=print_stacktrace=1 /home/travis/build/jeking3/boost-root/b2 . toolset=gcc-8 cxxstd=03,11,14,17,2a cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined define=BOOST_NO_STRESS_TEST=1 linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined linkflags=-fuse-ld=gold variant=debug -j3
First two errors:
https://travis-ci.org/jeking3/exception/jobs/454168878#L1151
https://travis-ci.org/jeking3/exception/jobs/454168878#L1248
For reference this started from a discussion here:
https://github.com/boostorg/algorithm/issues/52