Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11047: Valgrind warning "uninitialized variable" with lexical_cast on empty string as target
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-30 20:16:31
#11047: Valgrind warning "uninitialized variable" with lexical_cast on empty string
as target
-------------------------+-------------------------------------------------
Reporter: aedo99@⦠| Owner: apolukhin
Type: Bugs | Status: closed
Milestone: Boost | Component: lexical_cast
1.60.0 | Severity: Problem
Version: Boost | Keywords: lexical_cast uninitialized variable
1.47.0 | valgrind
Resolution: obsolete |
-------------------------+-------------------------------------------------
Changes (by apolukhin):
* status: assigned => closed
* resolution: => obsolete
Comment:
Looks like this issue was fixed somewhere between 1.47-1.59.
New code correctly handles empty strings:
* on empty string `m_begin == m_end`
*
[https://github.com/boostorg/lexical_cast/blob/master/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp#L186
Decrementing `m_end` without dereferencing]
*
[https://github.com/boostorg/lexical_cast/blob/master/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp#L189
`m_begin > m_end` is `true`], which will prevent the compiler from
evaluating the expression further, `false` will be returned.
* exception is thrown
Thanks for reporting this issue anyway!
If you need a fix for Boost 1.47, then just replace the line
{{{
if ( *end < czero || *end >= czero + 10 || begin > end)
}}}
with
{{{
if (begin > end || *end < czero || *end >= czero + 10)
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11047#comment:4> 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:19 UTC