From: Andrey Alekseenko Date: Tue, 21 Sep 2021 12:21:15 +0000 (+0300) Subject: Fix rare UB / assertion failure in MdlibUnitTest X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=5ac8cda6fbe06ad272cd487108bfc0df0bcbb8ad;p=alexxy%2Fgromacs.git Fix rare UB / assertion failure in MdlibUnitTest In LeapFrogHostTestRunner::integrate, we were checking whether testData->mdAtoms_.ptype is null, but we were not initializing this field. This was leading to occasional assertion failure in ArrayRef constructor from this pointer when begin+size was overflowing, which caused end < begin. Only unit tests were affected. --- diff --git a/src/gromacs/mdlib/tests/leapfrogtestdata.cpp b/src/gromacs/mdlib/tests/leapfrogtestdata.cpp index 9d1f7780be..3f66855450 100644 --- a/src/gromacs/mdlib/tests/leapfrogtestdata.cpp +++ b/src/gromacs/mdlib/tests/leapfrogtestdata.cpp @@ -170,6 +170,7 @@ LeapFrogTestData::LeapFrogTestData(int numAtoms, mdAtoms_.haveVsites = false; mdAtoms_.havePartiallyFrozenAtoms = false; mdAtoms_.cFREEZE = nullptr; + mdAtoms_.ptype = nullptr; update_ = std::make_unique(inputRecord_, nullptr); update_->updateAfterPartition(numAtoms,