Opened 8 years ago

#11146 new Bugs

iostreams seekpos/seekoff must not throw exceptions

Reported by: stheophil@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Currently, direct_streambuf<T, Tr>::seek_impl throws bad_seek() exception on invalid input.

The current standard draft N4296 says in section 27.8.2.4 about seekoff:

If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).

At least the MSVC STL implementation does not expect pubseekoff/seekoff to throw, thus does not catch the exception and the bad_seek() exception may leak to the caller even though ios_base::exceptions() is 0.

Change History (0)

Note: See TracTickets for help on using tickets.