[Boost-bugs] [Boost C++ Libraries] #13129: bracket_and_solve_root, toms748_solve; underflow when max_iter == 0

Subject: [Boost-bugs] [Boost C++ Libraries] #13129: bracket_and_solve_root, toms748_solve; underflow when max_iter == 0
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-21 04:09:37


#13129: bracket_and_solve_root, toms748_solve; underflow when max_iter == 0
--------------------------------+--------------------------
 Reporter: Tom C <clunietp@…> | Owner: John Maddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
--------------------------------+--------------------------
 ~line 295, math/tools/toms748_solve.hpp

 std::pair<T, T> toms748_solve(...)

 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.

 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.

 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.

 Alternatively/additionally, bracket_and_solve root is calling
 toms748_solve with max_iter==0; I don't know if that is desired behavior.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13129>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-07-21 04:12:45 UTC