From: kronbichler Date: Mon, 18 Oct 2010 14:43:50 +0000 (+0000) Subject: Fix illegal memory access in two loops: first check the bounds of access and then... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9a9b5fec9144f0538c50e7b77aaf6a743dc1f2b;p=dealii-svn.git Fix illegal memory access in two loops: first check the bounds of access and then the content. git-svn-id: https://svn.dealii.org/trunk@22362 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index e87e0155a2..574a8044f9 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -4325,16 +4325,14 @@ DoFTools::dof_indices_with_subdomain_association (const DH &dof_handle while (index < dof_handler.n_dofs()) { // find first_of - while ((subdomain_association[index] != subdomain) - && - (index < dof_handler.n_dofs())) + while ((index < dof_handler.n_dofs()) && + (subdomain_association[index] != subdomain)) ++index; const unsigned int begin = index; // find first_not_of - while ((subdomain_association[index] == subdomain) - && - (index < dof_handler.n_dofs())) + while ((index < dof_handler.n_dofs()) && + (subdomain_association[index] == subdomain)) ++index; const unsigned int end = index;