[Boost-bugs] [Boost C++ Libraries] #12889: Invalid downcast warning in boost::lexical_cast when using UBSAN

Subject: [Boost-bugs] [Boost C++ Libraries] #12889: Invalid downcast warning in boost::lexical_cast when using UBSAN
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-09 14:27:12


#12889: Invalid downcast warning in boost::lexical_cast when using UBSAN
------------------------------+--------------------------
 Reporter: arvo@… | Owner: apolukhin
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: lexical_cast
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
------------------------------+--------------------------
 The attempt to `lexical_cast` an `enum class` into a `std::string`
 produces a warning with UBSAN. GCC version:

 g++-6 (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901

 CXXFLAGS: -std=c++11 -fsanitize=undefined

 Warning text for the attached test program:

 {{{
 (...)/boost/lexical_cast/detail/converter_lexical_streams.hpp:236:43:
 runtime error: downcast of address 0x7ffddfb77d38 which does not point to
 an object of type 'basic_unlockedbuf'
 0x7ffddfb77d38: note: object is of type
 'std::__cxx11::basic_stringbuf<char, std::char_traits<char>,
 std::allocator<char> >'
  69 7f 00 00 e8 ca fb c9 69 7f 00 00 21 dc d8 00 00 00 00 00 21 dc d8
 00 00 00 00 00 21 dc d8 00
               ^~~~~~~~~~~~~~~~~~~~~~~
               vptr for 'std::__cxx11::basic_stringbuf<char,
 std::char_traits<char>, std::allocator<char> >'
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12889>
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-03-09 14:31:22 UTC