Opened 12 years ago

Last modified 12 years ago

#4654 new Patches

restricted_filter doesn't seek with the correct offset

Reported by: la06@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost Development Trunk Severity: Showstopper
Keywords: restrict restriction slice filter seek Cc:

Description

The class restricted_filter defined in detail/restrict_impl.hpp fails to seek properly due to a small, but significant, error in its seek member function.

The patch fixes this bug by changing the offset argument to the seek function of the underlying filter from

next

to

next - pos_

as the seek direction is BOOST_IOS::cur and not BOOST_IOS::beg.

In other words, the bug causes restricted filters to seek relative to the current pointer using offsets relative to the beginning. If you want to seek forward by 10 byte at position 5000, it'll seek forward by 5010 instead of 10.

Attachments (1)

patchfile.patch (532 bytes ) - added by la06@… 12 years ago.

Download all attachments as: .zip

Change History (3)

by la06@…, 12 years ago

Attachment: patchfile.patch added

comment:1 by la06@…, 12 years ago

Milestone: To Be Determined

comment:2 by Marshall Clow, 12 years ago

Any chance you can contribute a test case for this?

Note: See TracTickets for help on using tickets.