Fix out of bound vector access in vsites
[alexxy/gromacs.git] / src / programs / mdrun / tests / virtualsites.cpp
index c6b6009453eb513061ca7ff2ea0f36bf02b60592..8ce0c33d856f4e566ee60dff791d8974684578ae 100644 (file)
@@ -330,8 +330,8 @@ public:
                     virtualSites.emplace_back(VirtualSite{
                             vsiteType,
                             virtualSiteIdx,
-                            { &interactionList.iatoms[i + 2],
-                              &interactionList.iatoms[i + 2 + numConstructingAtoms] },
+                            { interactionList.iatoms.data() + i + 2,
+                              interactionList.iatoms.data() + i + 2 + numConstructingAtoms },
                             { localTopology.idef.iparams[parameterIdx].generic.buf,
                               localTopology.idef.iparams[parameterIdx].generic.buf + MAXFORCEPARAM } });
                     i += defaultIncrement;