[Boost-bugs] [Boost C++ Libraries] #10809: Seeking breaks iostreams::restriction<std::istream> internal state

Subject: [Boost-bugs] [Boost C++ Libraries] #10809: Seeking breaks iostreams::restriction<std::istream> internal state
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-11-21 01:47:49


#10809: Seeking breaks iostreams::restriction<std::istream> internal state
------------------------------+-----------------------
 Reporter: chris42f@… | Owner: turkanis
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------
 As in the attached test case, calling seekg() on a restricted istream
 appears to break the internal state such that more characters can be
 extracted than expected.

 I've done some digging around, and I think this is because the restriction
 device does a seek relative to std::ios_base::cur, which returns -1 from
 the underlying implementation: Calling std::streambuf::pubseekoff() with
 way = ios_base::cur and which = (ios_base::in | ios_base::out) fails
 according to the C++ standard section 27.8.2.4.

 When fixing this, it's worth noting that calling pubseekoff() will also
 fail with libstdc++ if it's passed (ios_base::in | ios_base::out) when the
 stream buffer has only an output buffer or input buffer, but not both.

 Tested with g++-4.6.3 and g++-4.8.? on 64 bit linux Ubuntu. Behaviour is
 consistent with clang++-libc++, but inconsistent with MSVC.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10809>
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:17 UTC