[Boost-bugs] [Boost C++ Libraries] #11958: boost::gregorian is not thread safe

Subject: [Boost-bugs] [Boost C++ Libraries] #11958: boost::gregorian is not thread safe
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-05 14:48:21


#11958: boost::gregorian is not thread safe
------------------------------------------------+------------------------
 Reporter: Mathieu Marquis Bolduc <mbolduc@…> | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------------------------+------------------------
 in greg_month.cpp,

 The static method get_month_map_ptr performs a non-thread-safe
 initialization of the month_map structure on the first access.

 If the first access is done concurrently, it is likely to crash with a
 segmentation fault as such:

 Program received signal SIGSEGV, Segmentation fault.
 #0 0x00007fffef9127d9 in std::_Rb_tree<std::string, std::pair<std::string
 const, unsigned short>, std::_Select1st<std::pair<std::string const,
 unsigned short> >, std::less<std::string>,
 std::allocator<std::pair<std::string const, unsigned short> >
>::_M_insert_unique(std::pair<std::string const, unsigned short> const&)
 ()
    from /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.54.0
 #1 0x00007fffef90fc90 in
 boost::gregorian::greg_month::get_month_map_ptr() () from /usr/lib/x86_64
 -linux-gnu/libboost_date_time.so.1.54.0
 #2 0x00007ffff4d41e07 in
 boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>
 (s=...) at /usr/include/boost/date_time/date_parsing.hpp:67
 #3 0x00007ffff4d4341a in
 boost::date_time::parse_date<boost::gregorian::date> (s=...,
 order_spec=order_spec_at_entry=0) at
 /usr/include/boost/date_time/date_parsing.hpp:143
 #4 0x00007ffff4d3a720 in from_string (s=...) at
 /usr/include/boost/date_time/gregorian/parsers.hpp:30

 I suggest initializing the map in a safe, lockless manner.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11958>
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-02-16 18:50:19 UTC