|
Boost : |
Subject: [boost] undefined behavior in Boost.Program_Options
From: Chris Rorvick (chris_at_[hidden])
Date: 2019-04-24 17:36:39
I am seeing my GCC ubsan builds littered with "downcast of address
xxxxxxxx which does not point to an object of type 'holder'" errors
[3] coming from Boost.Program_options (Boost 1.69). The issue has
been documented in various places [1][2] but I do not see anything on
the mailing list in recent months; apologies if I have missed
something.
A workaround is proposed on the StackOverflow post [1]. Does anyone
have any thoughts on this?
Many thanks!
Chris
[1] https://stackoverflow.com/questions/38987728/why-does-boostany-exhibit-undefined-behaviour-in-boostprogram-options
[2] https://github.com/boostorg/program_options/issues/76
[3]
.../boost/boost/any.hpp:249:17: runtime error: downcast of address
0x602000053610 which does not point to an object of type 'holder'
0x602000053610: note: object is of type 'boost::any::holder<std::string>'
6f 00 80 67 d0 91 ec 88 fe 7f 00 00 68 33 09 00 40 60 00 00 00 00
00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'boost::any::holder<std::string>'
#0 0x7ffe8df13e3d in
boost::program_options::typed_value<std::vector<std::string,
std::allocator<std::string> >, char>::xparse(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&) const
(redacted+0x28be3d)
#1 0x7ffe88bb0cd5 in
boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&, bool)
const (.../libboost_program_options.so.1.69.0+0xdacd5)
#2 0x7ffe88ba9193 in
boost::program_options::store(boost::program_options::basic_parsed_options<char>
const&, boost::program_options::variables_map&, bool)
(.../libboost_program_options.so.1.69.0+0xd3193)
#3 0x7fff0b727dbf in
rdx::launch::OptionsWrapper<boost::program_options::options_description,
boost::program_options::variables_map>::prepare(int, char**,
std::vector<int (*)(boost::program_options::options_description&),
std::allocator<int (*)(boost::program_options::options_description&)>
> const&) (redacted+0x448dbf)
#4 0x7fff0b755e80 in int generic_wrapper<std::vector<int
(*)(boost::program_options::options_description&), std::allocator<int
(*)(boost::program_options::options_description&)> >,
rdx::Function<int (boost::program_options::variables_map const&),
56u>, rdx::launch::OptionsWrapper<boost::program_options::options_description,
boost::program_options::variables_map> >(int, char**, std::vector<int
(*)(boost::program_options::options_description&), std::allocator<int
(*)(boost::program_options::options_description&)> > const&,
rdx::Function<int (boost::program_options::variables_map const&), 56u>
const&, rdx::launch::OptionsWrapper<boost::program_options::options_description,
boost::program_options::variables_map>&) (redacted+0x476e80)
#5 0x7fff0b76593c in redacted(std::string const&, int, char**,
std::vector<int (*)(boost::program_options::options_description&),
std::allocator<int (*)(boost::program_options::options_description&)>
> const&, rdx::Function<int (boost::program_options::variables_map
const&), 56u> const&) (redacted+0x48693c)
#6 0x95c21d in main (redacted+0x95c21d)
#7 0x7ffe82fb83d4 in __libc_start_main (/lib64/libc.so.6+0x223d4)
#8 0x963523 (redacted+0x963523)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk