Modify

Opened 8 years ago

Closed 8 years ago

#3839 closed Bugs (fixed)

[iostreams]write.hpp:write_device_impl<ostream_tag> tries access non-member f

Reported by: cppljevans@… Owned by: Daniel James
Milestone: Boost 1.43.0 Component: iostreams
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

In the boost/iostreams/write.hpp file, in template specialization:

struct write_device_impl<ostream_tag>

the line:

return !traits_type::eq_int_type( t.rdbuf()->s.sputc(),

should be changed to:

return !traits_type::eq_int_type( t.rdbuf()->sputc(c),

because a streambuf has no s member and the proposed changed reflects what's done elsewhere in the same file.

Attachments (3)

compose_indent_ostream~1.4~.cpp (926 bytes) - added by cppljevans@… 8 years ago.
demo of bug
indent.hpp (2.0 KB) - added by cppljevans@… 8 years ago.
file #included by previous attachment
ticket3839~demo.cpp (437 bytes) - added by cppljevans@… 8 years ago.
simpler bug demo

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by Steven Watanabe

It disturbs me that the tests don't catch this. Do you have a small test case that fails because of this?

Changed 8 years ago by cppljevans@…

demo of bug

Changed 8 years ago by cppljevans@…

Attachment: indent.hpp added

file #included by previous attachment

Changed 8 years ago by cppljevans@…

Attachment: ticket3839~demo.cpp added

simpler bug demo

comment:2 Changed 8 years ago by Daniel James

(In [60228]) Fix write_device_impl<ostream_tag>

And enchance the newline tests so that they test it. Refs #3839

comment:3 Changed 8 years ago by Daniel James

I've added a test to newline_tests, but it would be better if we had some more direct tests for write.hpp.

comment:4 Changed 8 years ago by Steven Watanabe

Component: Noneiostreams
Owner: set to Jonathan Turkanis

comment:5 Changed 8 years ago by Daniel James

Owner: changed from Jonathan Turkanis to Daniel James
Status: newassigned

comment:6 Changed 8 years ago by anonymous

Milestone: Boost 1.42.0Boost 1.43.0

comment:7 Changed 8 years ago by Daniel James

Resolution: fixed
Status: assignedclosed

(In [60666]) Merge iostreams.

  • Fix write_device_impl<ostream_tag>. Fixes #3839
  • Fix error checks after calling SetFilePointer?. Fixes #3953
  • Gzip filter shouldn't require its source to be peekable. Fixes #3723.
  • In position_to_offset, only cast to stream_offset after calculating _Myoff. Fixes #3969.
  • ptrdiff_t is in std. Fixes #2505.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Daniel James.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.