[Boost-bugs] [Boost C++ Libraries] #8536: Repeated shared_mutex.unlock_shared() can underflow

Subject: [Boost-bugs] [Boost C++ Libraries] #8536: Repeated shared_mutex.unlock_shared() can underflow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-01 17:27:35


#8536: Repeated shared_mutex.unlock_shared() can underflow
-----------------------------------------------+----------------------------
 Reporter: Zack Moratto <zmoratto@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: shared, mutex, underflow |
-----------------------------------------------+----------------------------
 Boost 1.53's shared_mutex can underflow if the user calls unlock_shared
 twice or right after construction.

 shared_mutex m();[[BR]]
 m.unlock_shared();

 The problem is specifically this line which can be found inside
 boost/thread/pthread/shared_mutex.hpp. ''(should be line 148)''

 {{{
             bool const last_reader=!--state.shared_count;
 }}}

 It doesn't check that state.shared_count is nonzero before decrementing.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8536>
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:13 UTC