Project

General

Profile

Actions

Bug #5240

closed

OBufferStream tries to flush when not open

Added by Davide Pesavento over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

OBufferStream::buf() unconditionally calls flush() before returning the buffer. However, some operations such as boost::iostreams::copy() will close both source and sink after they're done. Therefore, calling buf() after copying into a OBufferStream (a common case) will result in flushing a closed stream/device, which is illegal. If ndn-cxx is built in debug mode, an assertion failure like the following is triggered.

/usr/include/boost/iostreams/detail/optional.hpp:55: T& boost::iostreams::detail::optional<T>::operator*() [with T = boost::iostreams::detail::concept_adapter<ndn::detail::BufferAppendDevice>]: Assertion `initialized_' failed.
Actions #1

Updated by Davide Pesavento about 2 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 0 to 100
Actions #2

Updated by Davide Pesavento about 2 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF