]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add some more index range checks. 13182/head
authorDavid Wells <drwells@email.unc.edu>
Thu, 6 Jan 2022 20:30:30 +0000 (15:30 -0500)
committerDavid Wells <drwells@email.unc.edu>
Thu, 6 Jan 2022 20:30:30 +0000 (15:30 -0500)
We presently segmentation fault with #13179 (the draft intel oneAPI patch) here
since ptr and data are both empty.

include/deal.II/matrix_free/matrix_free.h

index 0b8d1e53945a61b6962a6dc974b41221a0384bbf..d7240ef755699c8e8ad99f896cdce9c31221f325 100644 (file)
@@ -4688,11 +4688,15 @@ namespace internal
       if (fu == nullptr)
         return;
 
+      AssertIndexRange(range_index + 1, ptr.size());
       for (unsigned int i = ptr[range_index]; i < ptr[range_index + 1]; ++i)
-        (container.*fu)(matrix_free,
-                        this->dst,
-                        this->src,
-                        std::make_pair(data[2 * i], data[2 * i + 1]));
+        {
+          AssertIndexRange(2 * i + 1, data.size());
+          (container.*fu)(matrix_free,
+                          this->dst,
+                          this->src,
+                          std::make_pair(data[2 * i], data[2 * i + 1]));
+        }
     }
 
   public:

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.