]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix invalid memory access of DoFAccessorImplementation 15451/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Fri, 23 Jun 2023 09:14:22 +0000 (11:14 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Fri, 23 Jun 2023 09:17:03 +0000 (11:17 +0200)
include/deal.II/dofs/dof_accessor.templates.h

index 9f96e0f3de5ae04defe63ac4b7420b2b9250e45d..d5505c5fca772e1d1f8bee9046c4d5d59ef2e89e 100644 (file)
@@ -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<types::global_dof_index> &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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.