From: Martin Kronbichler Date: Fri, 23 Jun 2023 09:14:22 +0000 (+0200) Subject: Fix invalid memory access of DoFAccessorImplementation X-Git-Tag: v9.5.0-rc1~43^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ae53b54780d08677ddfe0f5976771c4da73fdfd;p=dealii.git Fix invalid memory access of DoFAccessorImplementation --- diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 9f96e0f3de..d5505c5fca 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -516,9 +516,15 @@ namespace internal // determine range of dofs in global data structure const auto range = process_object_range(dof_handler, obj_level, obj_index, fe_index, dd); + if (range.second == 0) + return; + + std::vector &object_dof_indices = + dof_handler + .object_dof_indices[structdim < dim ? 0 : obj_level][structdim]; + AssertIndexRange(range.first, object_dof_indices.size()); types::global_dof_index *DEAL_II_RESTRICT stored_indices = - &dof_handler.object_dof_indices[structdim < dim ? 0 : obj_level] - [structdim][range.first]; + object_dof_indices.data() + range.first; // process dofs for (unsigned int i = 0; i < range.second; ++i, ++dof_indices_ptr)