New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bracket_and_solve_root, toms748_solve; underflow when max_iter == 0 #138

jzmaddock opened this Issue Jul 31, 2018 · 0 comments


None yet
1 participant
Copy link

jzmaddock commented Jul 31, 2018

~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.

Moved from :

@jzmaddock jzmaddock closed this in 5d590c8 Aug 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment