]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MGTransferMF: fix nullptr access
authorTimo Heister <timo.heister@gmail.com>
Tue, 13 Aug 2024 03:14:02 +0000 (23:14 -0400)
committerTimo Heister <timo.heister@gmail.com>
Tue, 13 Aug 2024 03:28:32 +0000 (23:28 -0400)
transfer[min_level] is never used and okay to be null

include/deal.II/multigrid/mg_transfer_global_coarsening.h

index 689fd70befed8086aafdfcaaca2015207efedcdf..b03fc8c28fa3e4b52d78247064014e326babd021 100644 (file)
@@ -1454,7 +1454,8 @@ MGTransferMF<dim, Number>::initialize_transfer_references(
 
   this->transfer.resize(min_level, max_level);
 
-  for (unsigned int l = min_level; l <= max_level; ++l)
+  // Note that transfer[min_level] is empty and never used:
+  for (unsigned int l = min_level + 1; l <= max_level; ++l)
     this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
       static_cast<const MGTwoLevelTransferBase<VectorType> &>(
         Utilities::get_underlying_value(transfer[l])));

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.