Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81507 - trunk/boost/property_tree
From: sebastian.redl_at_[hidden]
Date: 2012-11-24 09:47:19


Author: cornedbee
Date: 2012-11-24 09:47:18 EST (Sat, 24 Nov 2012)
New Revision: 81507
URL: http://svn.boost.org/trac/boost/changeset/81507

Log:
Don't use an uninitialized variable if trying to read a numeric char from a property and the value is out of bounds for the target type. See bug 4391. This is the only place where the warning that some compilers give makes sense; if it still occurs after this change, it's just broken.
Text files modified:
   trunk/boost/property_tree/stream_translator.hpp | 2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)

Modified: trunk/boost/property_tree/stream_translator.hpp
==============================================================================
--- trunk/boost/property_tree/stream_translator.hpp (original)
+++ trunk/boost/property_tree/stream_translator.hpp 2012-11-24 09:47:18 EST (Sat, 24 Nov 2012)
@@ -140,6 +140,7 @@
                 i < (std::numeric_limits<signed char>::min)())
             {
                 s.clear(); // guarantees eof to be unset
+ e = 0;
                 return;
             }
             e = (signed char)i;
@@ -161,6 +162,7 @@
             // out of range?
             if(i > (std::numeric_limits<unsigned char>::max)()) {
                 s.clear(); // guarantees eof to be unset
+ e = 0;
                 return;
             }
             e = (unsigned char)i;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk