Re: [Boost-bugs] [Boost C++ Libraries] #2659: optional_io insertion operator assumes presence of whitespace on stream

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2659: optional_io insertion operator assumes presence of whitespace on stream
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-12-12 12:17:58


#2659: optional_io insertion operator assumes presence of whitespace on stream
--------------------------------------------------------+-------------------
  Reporter: Andrew Troschinetz <ast@…> | Owner: fcacciola
      Type: Bugs | Status: closed
 Milestone: Boost 1.38.0 | Component: optional
   Version: Boost 1.37.0 | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------------------------+-------------------
Changes (by andysem):

  * status: new => closed
  * resolution: => wontfix

Comment:

 IMO, if reading a value from stream failed, the stream should be marked
 with failbit and reading must be stopped. This behavior is not only valid
 for boost::optional, but also for other types. This, in particular, allows
 user to detect invalid character sequences and not accidentally read
 invalid data (which could be a security issue).

 Extraction operator has been changed recently ([67183]) to include more
 robust input checking and not to miss invalid input.

 PS: Regarding the initial test case, the input "test" is not valid for
 boost::optional and thus reading it must fail. The basic rule about IO is
 that whatever is written with insertion operator may be read with
 extraction operator. And insertion operator always writes either space or
 dash as leading character.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2659#comment:5>
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:05 UTC