Subject: [Boost-bugs] [Boost C++ Libraries] #11163: generator::set_default_messages_domain either crashes or have unexpected side effects
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-02 13:16:21
#11163: generator::set_default_messages_domain either crashes or have unexpected
side effects
----------------------------------------+---------------------
Reporter: Anders Dalvander <boost@â¦> | Owner: artyom
Type: Bugs | Status: new
Milestone: To Be Determined | Component: locale
Version: Boost 1.57.0 | Severity: Problem
Keywords: crash |
----------------------------------------+---------------------
Calling generator::set_default_messages_domain before calling
generator::add_messages_domain using the same domain results in calling
vector::erase using an invalid iterator, which results in a crash.
Calling generator::set_default_messages_domain after calling
generator::add_messages_domain using the same domain results in adding the
domain twice to the vector.
This is due to using operator== instead of operator!= when comparing
iterator to vector::end().
Fix:
{{{
void generator::set_default_messages_domain(std::string const &domain)
{
std::vector<std::string>::iterator p;
if((p=std::find(d->domains.begin(),d->domains.end(),domain)) !=
d->domains.end()) {
d->domains.erase(p);
}
d->domains.insert(d->domains.begin(),domain);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11163> 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:18 UTC