Subject: Re: [boost] undefined behavior in Boost.Program_Options
From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-04-24 21:59:35
Chris Rorvick wrote:
> I am seeing my GCC ubsan builds littered with "downcast of address
> xxxxxxxx which does not point to an object of type 'holder'" errors 
> coming from Boost.Program_options (Boost 1.69). The issue has been
> documented in various places  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 . Does anyone have
> any thoughts on this?
> Many thanks!
>  https://github.com/boostorg/program_options/issues/76
> .../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>'
This doesn't seem to be the same issue as in the SO link. The cv qualifiers
are now being stripped by the constructor at
twice (once by `decay` and once by `remove_cv` for added safety) and in your
message the held object is non-const:
> note: object is of type 'boost::any::holder<std::string>'
My guess is that `holder` needs BOOST_SYMBOL_VISIBLE. That is,
class holder : public placeholder
needs to be
class BOOST_SYMBOL_VISIBLE holder : public placeholder
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk