Boost C++ Libraries: Ticket #8628: spsc_queue::pop(OutputIterator it) improperly works with random-access iterators if the read pointer is bigger than the write pointer (stored data consists of 2 blocks) https://svn.boost.org/trac10/ticket/8628 <p> spsc_queue::pop(<a class="missing wiki">OutputIterator</a> it) method improperly works with random-access iterators if the queue's read pointer is bigger than the queue's write pointer (the queue's stored data consists of 2 blocks) </p> <p> The following code will fill dst array improperly if the queue's read pointer is bigger than the queue's write pointer: </p> <p> unsigned char* dst=new unsigned char<a class="changeset" href="https://svn.boost.org/trac10/changeset/100" title="*** empty log message *** ">[100]</a>; </p> <p> count=q.pop(dst); </p> <p> The bug caused by the code in spsc_queue.hpp:224: </p> <p> std::copy(internal_buffer+read_index, internal_buffer+max_size, it); </p> <p> std::copy(internal_buffer, internal_buffer+count1, it); </p> <p> It will copy the second fragment starting from the same point it copied the first ftagment. The problem can be fixed as: </p> <p> it=std::copy(internal_buffer+read_index, internal_buffer+max_size, it); </p> <p> std::copy(internal_buffer, internal_buffer+count1, it); </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8628 Trac 1.4.3 Constantin Fishkin <constantin_fishkin@…> Wed, 29 May 2013 01:23:26 GMT severity changed https://svn.boost.org/trac10/ticket/8628#comment:1 https://svn.boost.org/trac10/ticket/8628#comment:1 <ul> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Not Applicable</span> </li> </ul> <p> Duplication of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8629" title="#8629: Bugs: spsc_queue::pop(OutputIterator it) improperly works with random-access ... (closed: fixed)">#8629</a> </p> Ticket