From 1eebd3efdbd469556b8a4c3800fc0499424d6513 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 5 Dec 2017 22:26:45 -0500 Subject: [PATCH] [Equil] Fix invalid memory access in VCS solver Before bba0d8edf, the vector m_molNumSpecies_new was of a size greater than m_nsp, with elements m_nsp through the end always filled with zeros. Thus the check removed here always passed. In bba0d8edf, the vector size was reduced to be the correct size (m_nsp), so this resulted in this check accessing unallocated memory, causing the check to fail randomly in the TestKOH_Equil test. The resulting exception was always caught internally, so the solver wasn't returning incorrect results, but the non-determinism was leading to unexpected changes in code coverage reports. --- src/equil/vcs_solve_TP.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 1ee8afbc5..6f8c9c08e 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -430,10 +430,6 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, m_tPhaseMoles_new[iph] += m_deltaMolNumSpecies[k]; } if (kspec >= m_numComponents) { - if (m_molNumSpecies_new[m_nsp] != 0.0) { - throw CanteraError("VCS_SOLVE::solve_tp_inner", - "we shouldn't be here!"); - } if (m_SSPhase[kspec] == 1) { m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDSS; } else {