Boost C++ Libraries: Ticket #786: bug in iostreams/copy.hpp line 81 https://svn.boost.org/trac10/ticket/786 <pre class="wiki">in boost 1_33_1 iostreams library file copy.hpp line 91 and following... it should rather be : streamsize amt; while ((amt=iostreams::read(src, buf.data(),buffer_size)) != -1) { std::copy(buf.data(), buf.data() + amt, p.first + total); total += amt; } return total; otherwise it happens that the std::copy line is called with amt =-1 which is a bug isnt it ? Regards, Mathieu </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/786 Trac 1.4.3 alexis_wilke Mon, 11 Dec 2006 05:48:52 GMT <link>https://svn.boost.org/trac10/ticket/786#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/786#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=554061 Originator: NO Mathieu, Actually, the copy operator will test if(_first &lt; _last) &lt;do the copy&gt; and if amt is -1 that condition will be false. Yet I agree that your way we would avoid one call and one variable ('done' in the original loop). I'm not part of boost so I cannot decide whether to apply the change. But this is only an optimization. Alexis </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 15 May 2007 16:33:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/786#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/786#comment:2</guid> <description> <p> There is a patch for this in "official patch format" in: <a class="ext-link" href="http://article.gmane.org/gmane.comp.lib.boost.user/23522"><span class="icon">​</span>http://article.gmane.org/gmane.comp.lib.boost.user/23522</a> </p> </description> <category>Ticket</category> </item> <item> <author>chris@…</author> <pubDate>Sat, 30 Jun 2007 00:02:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/786#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/786#comment:3</guid> <description> <p> Alexis, </p> <p> My copy operator did not perform your test and I saw the bug (5 or 6 levels down the stack a copy for <span class="underline">last-</span>first would eventually SIGSEGV in memcpy.) </p> <p> - </p> <p> Chris DUrso </p> </description> <category>Ticket</category> </item> <item> <author>qbowater@…</author> <pubDate>Sat, 07 Jul 2007 03:47:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/786#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/786#comment:4</guid> <description> <p> Replying to <a class="missing ticket" title="ticket comment does not exist">alexis_wilke</a>: </p> <blockquote class="citation"> <p> Mathieu, </p> <p> Actually, the copy operator will test if(_first &lt; _last) &lt;do the copy&gt; and if amt is -1 that condition will be false. Yet I agree that your way we would avoid one call and one variable ('done' in the original loop). I'm not part of boost so I cannot decide whether to apply the change. But this is only an optimization. Alexis </p> </blockquote> <p> In VC8 DEBUG mode,it will assert in std::copy because "first &gt; last". It make difficult to debug program.I think it should be repaired necessarily. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 11 Jul 2007 04:10:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/786#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/786#comment:5</guid> <description> <p> This looks like a duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1070" title="#1070: Bugs: [iostreams]boost\iostreams\copy.hpp line80 copy_impl (closed: fixed)">#1070</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daryle Walker</dc:creator> <pubDate>Fri, 03 Aug 2007 12:17:21 GMT</pubDate> <title>component changed; severity set https://svn.boost.org/trac10/ticket/786#comment:6 https://svn.boost.org/trac10/ticket/786#comment:6 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">iostreams</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket Jonathan Turkanis Tue, 25 Dec 2007 08:51:01 GMT status, resolution changed https://svn.boost.org/trac10/ticket/786#comment:7 https://svn.boost.org/trac10/ticket/786#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/42294" title="fixed issues #786 and (duplicate) #1070">[42294]</a> in branches/iostreams_dev, to be merged into trunk shortly. The fix is a slight modification of the suggestion above. </p> Ticket