From a68bd3c8aea50ebb5895755335278345b89760d9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 May 2006 22:18:13 +0000 Subject: [PATCH] Add a few safety checks. git-svn-id: https://svn.dealii.org/trunk@12983 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/hp_dof_handler.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/deal.II/deal.II/include/dofs/hp_dof_handler.h b/deal.II/deal.II/include/dofs/hp_dof_handler.h index 1967901f84..4976f2d357 100644 --- a/deal.II/deal.II/include/dofs/hp_dof_handler.h +++ b/deal.II/deal.II/include/dofs/hp_dof_handler.h @@ -1338,7 +1338,9 @@ namespace hp Assert (local_index < (*finite_elements)[fe_index].dofs_per_vertex, ExcIndexRange(local_index, 0, (*finite_elements)[fe_index].dofs_per_vertex)); - + Assert (vertex_index < vertex_dofs_offsets.size(), + ExcIndexRange (vertex_index, 0, vertex_dofs_offsets.size())); + // hop along the list of index // sets until we find the one // with the correct fe_index, and @@ -1350,12 +1352,19 @@ namespace hp const unsigned int *pointer = &vertex_dofs[starting_offset]; while (true) { - Assert (*pointer != deal_II_numbers::invalid_unsigned_int, + Assert (pointer <= &vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index != deal_II_numbers::invalid_unsigned_int, ExcInternalError()); - if (*pointer == fe_index) + Assert (this_fe_index < finite_elements->size(), + ExcInternalError()); + + if (this_fe_index == fe_index) return *(pointer + 1 + local_index); else - pointer += (*finite_elements)[*pointer].dofs_per_vertex; + pointer += (*finite_elements)[this_fe_index].dofs_per_vertex; } } -- 2.39.5