Opened 13 years ago

Closed 13 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@… 13 years ago.
demo of bug
indent.hpp (2.0 KB ) - added by cppljevans@… 13 years ago.
file #included by previous attachment
ticket3839~demo.cpp (437 bytes ) - added by cppljevans@… 13 years ago.
simpler bug demo

Download all attachments as: .zip

Change History (10)

comment:1 by Steven Watanabe, 13 years ago

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

by cppljevans@…, 13 years ago

demo of bug

by cppljevans@…, 13 years ago

Attachment: indent.hpp added

file #included by previous attachment

by cppljevans@…, 13 years ago

Attachment: ticket3839~demo.cpp added

simpler bug demo

comment:2 by Daniel James, 13 years ago

(In [60228]) Fix write_device_impl<ostream_tag>

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

comment:3 by Daniel James, 13 years ago

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 by Steven Watanabe, 13 years ago

Component: Noneiostreams
Owner: set to Jonathan Turkanis

comment:5 by Daniel James, 13 years ago

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

comment:6 by anonymous, 13 years ago

Milestone: Boost 1.42.0Boost 1.43.0

comment:7 by Daniel James, 13 years ago

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.
Note: See TracTickets for help on using tickets.