[Boost-bugs] [Boost C++ Libraries] #9164: Dereference null return value in make_shared_object.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #9164: Dereference null return value in make_shared_object.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-26 06:08:53


#9164: Dereference null return value in make_shared_object.hpp
--------------------------------------+-----------------------
 Reporter: Gaurav Gupta <g.gupta@…> | Owner: pdimov
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: smart_ptr
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
--------------------------------------+-----------------------
 Using some static analyzer tool , Boost reports warning messages
 Dereference null return value.

 In codes like:
 boost::detail::sp_ms_deleter< T > * pd =
 static_cast<boost::detail::sp_ms_deleter< T > *>(
 pt._internal_get_untyped_deleter() );

 pd is dereference in next line : void * pv = pd->address();

 If pd is NULL in above call, dereferencing it may cause crash.

 It can be avoided by using:
 BOOST_ASSERT(!pd);

 It is at many places.

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