Re: [Boost-bugs] [Boost C++ Libraries] #4781: Boost Program Options 'arg' text could be editiable.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4781: Boost Program Options 'arg' text could be editiable.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-13 07:36:30


#4781: Boost Program Options 'arg' text could be editiable.
----------------------------------------+-----------------------------------
  Reporter: robertmassaioli@… | Owner: vladimir_prus
      Type: Feature Requests | Status: closed
 Milestone: To Be Determined | Component: program_options
   Version: Boost 1.44.0 | Severity: Problem
Resolution: fixed | Keywords: arg program_options
----------------------------------------+-----------------------------------

Comment (by pbf@…):

 I'm encountering a problem, whereby I have a shared library that
 statically links to program_options, and an application that also
 statically links to it, but dynamically links to the shared library. When
 the program terminates, it tries to double delete the string "arg",
 causing potential heap corruption.

 While I'm aware that this usage of boost violates the one definition rule,
 and is generally dangerous, I need to do it anyway..

 I've managed to resolve the issue by patching my version of
 program_options with the following changes:

 value_semantic.cpp

 {{{
 85: BOOST_PROGRAM_OPTIONS_DECL char* arg = "arg";
 }}}

 value_semantic.hpp

 {{{
 13: extern BOOST_PROGRAM_OPTIONS_DECL char* arg;
 19: const std::string var = (m_value_name.empty() ? arg :
 m_value_name);
 }}}

 I'd like to suggest this as a patch for the next release, since I'm sure
 I'm not the only one who's encountered this problem. (In fact, someone
 already did, last year in the boost Users forum)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4781#comment:16>
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:11 UTC