Fix out-of-bounds memory access in CvodesIntegrator::getErrorInfo

Out-of-bounds memory was being accessed in cases where the system had fewer
state variables than the specified maximum number of error estimates to display.
This commit is contained in:
Ray Speth 2015-04-28 17:07:16 -04:00
parent de1884db71
commit 4049bb4bb2

View file

@ -465,6 +465,7 @@ string CVodesIntegrator::getErrorInfo(int N)
N_VDestroy(errs);
N_VDestroy(errw);
N = std::min(N, static_cast<int>(m_neq));
sort(weightedErrors.begin(), weightedErrors.end());
stringstream s;
for (int i=0; i<N; i++) {