Boost C++ Libraries: Ticket #9400: Boost spirit double_ parser crashes (array out of bounds) on values over 1e308 https://svn.boost.org/trac10/ticket/9400 <p> How to reproduce: </p> <pre class="wiki">std::string test = "00573e443ef8ec10b5a1f23ac8964c43c415cedf"; std::string::const_iterator s_begin = test .begin(); std::string::const_iterator s_end = test .end(); boost::spirit::qi::phrase_parse(s_begin, s_end, boost::spirit::qi::double_, boost::spirit::iso8859_1::space, out); </pre><p> Note that this value get's interpreted as a double 573E+443. </p> <p> There is an array index out of bounds in the function: </p> <pre class="wiki">boost/spirit/home/support/detail/pow10.hpp, line 88 </pre><p> because the exponent larger than 308. I suggest throwing an exception here if the exponent is &gt;308 so that we can handle if a user enters a value larger than the max double. Otherwise the double_ parser is unusable for user input or user provided data. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9400 Trac 1.4.3 russell.hay@… Tue, 06 Jan 2015 23:20:28 GMT <link>https://svn.boost.org/trac10/ticket/9400#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9400#comment:1</guid> <description> <p> I have found that this is also the case when the value std::numeric_limits&lt;double&gt;::lowest() or ::max() are generated by karma. I'm trying to understand exactly how the generation works that causes it to have exp = 309, but haven't determined the cause yet. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Wed, 24 Apr 2019 06:41:50 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9400#comment:2 https://svn.boost.org/trac10/ticket/9400#comment:2 <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> Fixed in <a class="ext-link" href="https://github.com/boostorg/spirit/issues/495"><span class="icon">​</span>https://github.com/boostorg/spirit/issues/495</a> </p> Ticket