Actions
Bug #5240
closedOBufferStream tries to flush when not open
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