Boost C++ Libraries: Ticket #13129: bracket_and_solve_root, toms748_solve; underflow when max_iter == 0 https://svn.boost.org/trac10/ticket/13129 <p> ~line 295, math/tools/toms748_solve.hpp </p> <p> std::pair&lt;T, T&gt; toms748_solve(...) </p> <p> Parameter max_iter is boost::uintmax_t. Line ~343 decrements count (--count) with no prior checks on the value of max_iter, resulting in an underflow if the provided max_iter==0. </p> <p> This was discovered when calling bracket_and_solve root (with max_iters==15), which internally calls toms748_solve with max_iter==0, leading to the underflow/infinite(?) loop. </p> <p> Unfortunately due to the nature of bracket_and_solve root I'm unable to provide a minimal repro, but to repro the underflow simply call toms748_solve with max_iter==0, which it does not appear to be checking against. </p> <p> Alternatively/additionally, bracket_and_solve root is calling toms748_solve with max_iter==0; I don't know if that is desired behavior. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13129 Trac 1.4.3 John Maddock Tue, 31 Jul 2018 17:48:55 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13129#comment:1 https://svn.boost.org/trac10/ticket/13129#comment:1 <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">obsolete</span> </li> </ul> <p> Moved to <a class="ext-link" href="https://github.com/boostorg/math/issues/138"><span class="icon">​</span>https://github.com/boostorg/math/issues/138</a> </p> Ticket