Opened 8 years ago

Closed 7 years ago

#11047 closed Bugs (obsolete)

Valgrind warning "uninitialized variable" with lexical_cast on empty string as target

Reported by: aedo99@… Owned by: Antony Polukhin
Milestone: Boost 1.60.0 Component: lexical_cast
Version: Boost 1.47.0 Severity: Problem
Keywords: lexical_cast uninitialized variable valgrind Cc:

Description

Hello, I have a problem with boost::lexical_cast<int>(aString) when aString is an empty string ("").

In that case, valgrind complains with a warning "uninitialized variable".

Attachments (1)

Screenshot 2015-02-18 18.10.16.png (151.8 KB ) - added by aedo99@… 8 years ago.

Download all attachments as: .zip

Change History (5)

by aedo99@…, 8 years ago

comment:1 by viboes, 8 years ago

Component: Nonelexical_cast
Owner: set to Antony Polukhin

comment:2 by anonymous, 7 years ago

Hello,

any news on this?

comment:3 by Antony Polukhin, 7 years ago

Milestone: To Be DeterminedBoost 1.60.0
Status: newassigned

comment:4 by Antony Polukhin, 7 years ago

Resolution: obsolete
Status: assignedclosed

Looks like this issue was fixed somewhere between 1.47-1.59.

New code correctly handles empty strings:

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)
Note: See TracTickets for help on using tickets.