Commits

Stefano Zampini  committed 09af071

PCBDDC: protect code for mirrors by graph size.

These are invalid reads in multilevel

  • Participants
  • Parent commits 37d3b23

Comments (0)

Files changed (1)

File src/ksp/pc/impls/bddc/bddcgraph.c

 
   /* get local periodic nodes */
   mirrors_found=PETSC_FALSE;
-  for (i=0;i<n_shared[0];i++)
-    graph->count[shared[0][i]] += 1;
-  for (i=0;i<n_shared[0];i++) {
-    if (graph->count[shared[0][i]] > 1) {
-      mirrors_found=PETSC_TRUE;
-      break;
+  if (graph->nvtxs) { 
+    for (i=0;i<n_shared[0];i++)
+      graph->count[shared[0][i]] += 1;
+    for (i=0;i<n_shared[0];i++) {
+      if (graph->count[shared[0][i]] > 1) {
+        mirrors_found=PETSC_TRUE;
+        break;
+      }
     }
   }
   /* compute local mirrors (if any) */