From 4ba78e787e19b97d8b998a2b10898ac8c54dbaa1 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 22 Mar 2017 19:11:52 +0100 Subject: [PATCH] Check access in SparsityPatter::compress() --- source/lac/sparsity_pattern.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index fdd32cfbc2..e249977736 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -437,8 +437,11 @@ SparsityPattern::compress () // some internal checks: either the matrix is not quadratic, or if it // is, then the first element of this row must be the diagonal element // (i.e. with column index==line number) + // this test only makes sense if we have written to the index + // rowstart_line in new_colnums which is the case if row_length is not 0, + // so check this first Assert ((!store_diagonal_first_in_row) || - (new_colnums[rowstart[line]] == line), + (row_length != 0 && new_colnums[rowstart[line]] == line), ExcInternalError()); // assert that the first entry does not show up in the remaining ones // and that the remaining ones are unique among themselves (this handles -- 2.39.5