]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix out of bounds access
authorTimo Heister <timo.heister@gmail.com>
Mon, 27 Jul 2015 21:10:15 +0000 (17:10 -0400)
committerTimo Heister <timo.heister@gmail.com>
Tue, 28 Jul 2015 13:41:01 +0000 (09:41 -0400)
source/base/tensor_product_polynomials.cc

index 61423c94bb467a77e9283ea882b6ee43a57cbf94..aa8ce7230c27d76e693df14d7c38c2d522821b42 100644 (file)
@@ -357,13 +357,19 @@ AnisotropicPolynomials<dim>::
 compute_index (const unsigned int i,
                unsigned int       (&indices)[dim]) const
 {
+#ifdef DEBUG
   unsigned int n_poly = 1;
   for (unsigned int d=0; d<dim; ++d)
     n_poly *= polynomials[d].size();
   Assert (i < n_poly, ExcInternalError());
-
-  internal::compute_tensor_index(i, polynomials[0].size(),
-                                 polynomials[1].size(), indices);
+#endif
+
+  if (dim==1)
+    internal::compute_tensor_index(i, polynomials[0].size(),
+                                   0 /*not used*/, indices);
+  else
+    internal::compute_tensor_index(i, polynomials[0].size(),
+                                   polynomials[1].size(), indices);
 }
 
 

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.