]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a few safety checks.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 May 2006 22:18:13 +0000 (22:18 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 May 2006 22:18:13 +0000 (22:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@12983 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/hp_dof_handler.h

index 1967901f84000332726facade79245f39d8998c9..4976f2d3570c0b90672b25d3223c972859639300 100644 (file)
@@ -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;
       }
   }  
 

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.