id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8309,[iostreams] bad handling of non-blocking writes for ‘indirect_streambuf’ class,fpascutti@…,Jonathan Turkanis,"When a non-blocking write is done, the {{{indirect_streambuf}}} class sets the pointer to the start of the put area ({{{pbase()}}}) to the start of his own internal buffer ({{{out().buffer()}}}) offset by the number of bytes consumed. This algorithm works with a single non-blocking write but fails with multiple successive non-blocking writes. Imagine the following scenario: 1. Initially, {{{pbase()}}}, {{{pptr()}}} and {{{out().begin()}}} point to address {{{0x1000}}}. 2. 8 characters/bytes are written (assuming char as char_type). 3. {{{pptr()}}} is set to {{{0x1008}}}. 4. Only 2 characters are consumed downstream. 5. {{{pbase()}}} is correctly set to {{{0x1002}}}. {{{pptr()}}} remains at {{{0x1008}}}. 6. 2 more characters are consumed downstream. 7. **{{{pbase()}}} is wrongly set to {{{0x1002}}}**. It should be set to {{{0x1004}}}. I have attached a [[attachment:nonblocking_indirect_streambuf_write.cpp|file containing a sample unit-test]] that reproduces this scenario. The fix looks easy as the {{{pbase()}}} pointer needs to be set to its previous value offset by the number of bytes consumed. I have attached a [[attachment:indirect_streambuf.hpp.patch|patch]] that implements this fix and makes the unit-test pass. However I am unable to assess the impact or correctness of this fix.",Bugs,new,To Be Determined,iostreams,Boost 1.53.0,Problem,,,