Subject: [Boost-bugs] [Boost C++ Libraries] #4685: boost::interprocess::winapi::get_last_bootup_time( std::wstring&)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-09-26 02:16:40
#4685: boost::interprocess::winapi::get_last_bootup_time( std::wstring&)
----------------------------------------+-----------------------------------
Reporter: Jim Bell <jim@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.44.0 | Severity: Problem
Keywords: |
----------------------------------------+-----------------------------------
boost::interprocess::winapi::get_last_bootup_time( std::wstring& strValue
)
This line is wrong and is crashing most of the win32 regression tests
(both release and trunk):
{{{
strValue.erase(strValue.find(L'+'));
}}}
strValue doesn't have '+', so .find() returns std::wstring::npos, but that
causes std::wstring::erase() to crash. npos isn't a valid parameter to
erase() and will cause an out_of_range exception to be thrown.
[http://stdcxx.apache.org/doc/stdlibref/basic-string.html#idx349]
I think this is causing many regression test failures both the release and
trunk branches for win32.
The fix would be to split it out:
{{{
std::wstring::size_type plusPos = strValue.find(L'+');
if (plusPos != std::wstring::npos)
strValue.erase(plusPos);
}}}
I can't speak to why you're looking for a '+' and the significance of not
finding it.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4685> 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:04 UTC