Boost C++ Libraries: Ticket #5115: iostreams non_blocking_adapter read bug https://svn.boost.org/trac10/ticket/5115 <p> When reading from device resulting amount of read bytes is ignored. </p> <p> line 31. of boost/iostreams/detail/adapter/non_blocking_adapter.hpp </p> <pre class="wiki"> explicit non_blocking_adapter(Device&amp; dev) : device_(dev) { } std::streamsize read(char_type* s, std::streamsize n) { std::streamsize result = 0; while (result &lt; n) { - std::streamsize amt = iostreams::read(device_, s, n); + std::streamsize amt = iostreams::read(device_, s, n - result); if (amt == -1) break; result += amt; } return result != 0 ? result : -1; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5115 Trac 1.4.3 Mario Suvajac <msuvajac@…> Mon, 24 Jan 2011 19:03:50 GMT <link>https://svn.boost.org/trac10/ticket/5115#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5115#comment:1</guid> <description> <p> actually, it should be: </p> <pre class="wiki">- std::streamsize amt = iostreams::read(device_, s, n); + std::streamsize amt = iostreams::read(device_, s + result, n - result); </pre> </description> <category>Ticket</category> </item> <item> <author>msuvajac@…</author> <pubDate>Sun, 11 Mar 2012 16:25:10 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/5115 https://svn.boost.org/trac10/ticket/5115 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> Buffer overwrite test case. </p> Ticket msuvajac@… Sun, 11 Mar 2012 16:25:53 GMT attachment set https://svn.boost.org/trac10/ticket/5115 https://svn.boost.org/trac10/ticket/5115 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">nb.diff</span> </li> </ul> <p> Patch </p> Ticket msuvajac@… Sun, 11 Mar 2012 16:30:14 GMT <link>https://svn.boost.org/trac10/ticket/5115#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5115#comment:2</guid> <description> <p> I've added a test case for this bug and a patch. </p> <p> Also another issue for this adapter is if a device returns 0 as the amount read/written, that would cause a deadlock - endless loop. </p> </description> <category>Ticket</category> </item> <item> <author>msuvajac@…</author> <pubDate>Tue, 13 Mar 2012 17:09:04 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/5115#comment:3 https://svn.boost.org/trac10/ticket/5115#comment:3 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Patches</span> </li> </ul> Ticket