Boost C++ Libraries: Ticket #7784: [PATCH] Overlapping strings are not properly handled by string::algo::find_all https://svn.boost.org/trac10/ticket/7784 <p> See attached test case. There should be two matches in the following test case, one at index 0 and one at index 1, but boost::string::algorithm::find_all only finds one at index 0. I suspect the bug is that the string match erroneously restarts from the end of the previous match, not from beginning of the previous match + 1. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7784 Trac 1.4.3 cedstrom@… Tue, 11 Dec 2012 07:34:22 GMT attachment set https://svn.boost.org/trac10/ticket/7784 https://svn.boost.org/trac10/ticket/7784 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">OverlappingStringTest.cpp</span> </li> </ul> <p> Overlapping String Test Case </p> Ticket anonymous Thu, 20 Dec 2012 09:59:00 GMT <link>https://svn.boost.org/trac10/ticket/7784#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7784#comment:1</guid> <description> <p> Patch which I believe fixes this: </p> <pre class="wiki">Index: boost-trunk/boost/algorithm/string/find_iterator.hpp =================================================================== --- boost-trunk/boost/algorithm/string/find_iterator.hpp (revision 82112) +++ boost-trunk/boost/algorithm/string/find_iterator.hpp (working copy) @@ -132,7 +132,10 @@ // increment void increment() { - m_Match=this-&gt;do_find(m_Match.end(),m_End); + if(m_Match.begin() == m_Match.end()) + m_Match=this-&gt;do_find(m_Match.end(),m_End); + else + m_Match=this-&gt;do_find(m_Match.begin()+1,m_End); } // comparison </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 20 Dec 2012 09:59:22 GMT</pubDate> <title>summary changed https://svn.boost.org/trac10/ticket/7784#comment:2 https://svn.boost.org/trac10/ticket/7784#comment:2 <ul> <li><strong>summary</strong> <span class="trac-field-old">Overlapping strings are not properly handled by string::algo::find_all</span> → <span class="trac-field-new">[PATCH] Overlapping strings are not properly handled by string::algo::find_all</span> </li> </ul> Ticket Marshall Clow Thu, 20 Dec 2012 16:28:34 GMT <link>https://svn.boost.org/trac10/ticket/7784#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7784#comment:3</guid> <description> <p> Applied patch and added test case in <a class="changeset" href="https://svn.boost.org/trac10/changeset/82117" title="Fixed bug in boost::algorithm::find_all with overlapping results; ...">[82117]</a>. Thanks for the patch! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 02 Jan 2013 18:40:43 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7784#comment:4 https://svn.boost.org/trac10/ticket/7784#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82238" title="Merge bug fix and test to release; Fixes #7784">[82238]</a> merge fix to release. </p> Ticket Steven Watanabe Mon, 04 Mar 2013 16:20:52 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/7784#comment:5 https://svn.boost.org/trac10/ticket/7784#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Marshall, I don't think that this patch should have been applied. I believe that the library is intended to return non-overlapping matches. Rationale: (1) find_all is in split.hpp, the documentation says: "Split algorithms can be used to divide a string into several parts...." (2) For the sake of consistency, find_all, replace_all, and erase_all, should all use the same set of matches. The patch breaks this. (3) boost::regex_iterator also finds non-overlapping matches. </p> Ticket Marshall Clow Mon, 09 Sep 2013 18:02:35 GMT <link>https://svn.boost.org/trac10/ticket/7784#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7784#comment:6</guid> <description> <p> This fix broke other stuff. See <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9063" title="#9063: Bugs: token_finder with token_compress_on broken (closed: fixed)">#9063</a>. </p> <p> I'm considering reverting it. </p> <p> If you have objections, now would be a good time to speak up. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 08 Oct 2013 17:54:23 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7784#comment:7 https://svn.boost.org/trac10/ticket/7784#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> No one complained. </p> <p> Reverting this. </p> Ticket