Boost C++ Libraries: Ticket #11792: Boost convert will dereference empty strings iterators https://svn.boost.org/trac10/ticket/11792 <p> The dereference can be found in <code>boost/convert/base.hpp</code>:<code>to_str_</code> (line 108 in boost 1.59.0). </p> <pre class="wiki"> /**/ if (skipws_) for (; std::isspace(*range.begin()); ++range); else if (std::isspace(*range.begin())) return; </pre><p> <code>range</code> should be checked to see if it is empty before it is dereferenced. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11792 Trac 1.4.3 anonymous Wed, 18 Nov 2015 00:14:27 GMT <link>https://svn.boost.org/trac10/ticket/11792#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11792#comment:1</guid> <description> <p> I made a pull request here: </p> <p> <a class="ext-link" href="https://github.com/boostorg/convert/pull/22"><span class="icon">​</span>https://github.com/boostorg/convert/pull/22</a> </p> <p> Not sure if it's the right way to go about it (both doing a pull request and the proposed fix itself). </p> </description> <category>Ticket</category> </item> <item> <author>vbmail247@…</author> <pubDate>Wed, 18 Nov 2015 05:58:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11792#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11792#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11792#comment:1" title="Comment 1">anonymous</a>: </p> <blockquote class="citation"> <p> I made a pull request here: </p> <p> <a class="ext-link" href="https://github.com/boostorg/convert/pull/22"><span class="icon">​</span>https://github.com/boostorg/convert/pull/22</a> </p> <p> Not sure if it's the right way to go about it (both doing a pull request and the proposed fix itself). </p> </blockquote> <p> Yes, indeed. The code currently does not handle empty strings. Missed that. Thank you. Unfortunately, adding "if (str.empty())" only works for std::string when str_to_() was meant to support C strings and user strings as well. After a brief look the change will probably have to go to the cnv::range constructor specializations. Let me think about it. I'll address it ASAP. </p> <p> Thank you, Vladimir. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 18 Nov 2015 10:40:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11792#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11792#comment:3</guid> <description> <p> Just corrected the problem. Checked it into "develop" and synced to the "master". </p> </description> <category>Ticket</category> </item> <item> <author>Brad Anderson <eco@…></author> <pubDate>Wed, 18 Nov 2015 18:31:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11792#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11792#comment:4</guid> <description> <p> I have one more issue I've hit using Boost Convert. I think I lack the metaprogramming skills to really understand what is going on. I'd love if someone could take a look. I've documented it here: </p> <p> <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/11800"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/11800</a> </p> </description> <category>Ticket</category> </item> <item> <author>Vladimir Batov <vbmail247@…></author> <pubDate>Fri, 20 Nov 2015 22:01:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11792#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11792#comment:5</guid> <description> <p> The previous fix still had a problem which unfortunately did not show up with gcc and clang. Namely, boost::cnv::cnvbase::str_to_() was potentially trying to dereference the end() iterator. If my memory serves me, MSVC is strict about it. gcc &amp; clang are lenient in that regard so I did not catch it. Hopefully fixed that now. Will monitor in the regression tests. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 03 Jan 2016 22:07:02 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/11792#comment:6 https://svn.boost.org/trac10/ticket/11792#comment:6 <ul> <li><strong>owner</strong> set to <span class="trac-author">viboes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">convert</span> </li> </ul> Ticket viboes Mon, 08 Aug 2016 22:30:42 GMT owner changed https://svn.boost.org/trac10/ticket/11792#comment:7 https://svn.boost.org/trac10/ticket/11792#comment:7 <ul> <li><strong>owner</strong> changed from <span class="trac-author">viboes</span> to <span class="trac-author">Vladimir Batov</span> </li> </ul> Ticket Vladimir Batov Mon, 08 Aug 2016 22:42:29 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11792#comment:8 https://svn.boost.org/trac10/ticket/11792#comment:8 <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> Ticket