From 53998a1da9974d712f43e3ddccafc7049ed65ffc Mon Sep 17 00:00:00 2001 From: sfilippone Date: Mon, 28 Aug 2023 13:25:53 +0200 Subject: [PATCH] Fixed out of bound accesses. --- amgprec/impl/aggregator/amg_c_soc1_map_bld.F90 | 1 + amgprec/impl/aggregator/amg_d_soc1_map_bld.F90 | 1 + amgprec/impl/aggregator/amg_s_soc1_map_bld.F90 | 1 + amgprec/impl/aggregator/amg_z_soc1_map_bld.F90 | 1 + 4 files changed, 4 insertions(+) diff --git a/amgprec/impl/aggregator/amg_c_soc1_map_bld.F90 b/amgprec/impl/aggregator/amg_c_soc1_map_bld.F90 index 4041ebe5..53892ebc 100644 --- a/amgprec/impl/aggregator/amg_c_soc1_map_bld.F90 +++ b/amgprec/impl/aggregator/amg_c_soc1_map_bld.F90 @@ -248,6 +248,7 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in j = icol(k) ! If any of the neighbours is already assigned, ! we will not reset. + if (j>nr) cycle step1 if (ilaggr(j) > 0) cycle step1 if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then ip = ip + 1 diff --git a/amgprec/impl/aggregator/amg_d_soc1_map_bld.F90 b/amgprec/impl/aggregator/amg_d_soc1_map_bld.F90 index de95abce..fba80c10 100644 --- a/amgprec/impl/aggregator/amg_d_soc1_map_bld.F90 +++ b/amgprec/impl/aggregator/amg_d_soc1_map_bld.F90 @@ -248,6 +248,7 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in j = icol(k) ! If any of the neighbours is already assigned, ! we will not reset. + if (j>nr) cycle step1 if (ilaggr(j) > 0) cycle step1 if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then ip = ip + 1 diff --git a/amgprec/impl/aggregator/amg_s_soc1_map_bld.F90 b/amgprec/impl/aggregator/amg_s_soc1_map_bld.F90 index 0a809624..857c6ff3 100644 --- a/amgprec/impl/aggregator/amg_s_soc1_map_bld.F90 +++ b/amgprec/impl/aggregator/amg_s_soc1_map_bld.F90 @@ -248,6 +248,7 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in j = icol(k) ! If any of the neighbours is already assigned, ! we will not reset. + if (j>nr) cycle step1 if (ilaggr(j) > 0) cycle step1 if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then ip = ip + 1 diff --git a/amgprec/impl/aggregator/amg_z_soc1_map_bld.F90 b/amgprec/impl/aggregator/amg_z_soc1_map_bld.F90 index 2c467426..50fe70a2 100644 --- a/amgprec/impl/aggregator/amg_z_soc1_map_bld.F90 +++ b/amgprec/impl/aggregator/amg_z_soc1_map_bld.F90 @@ -248,6 +248,7 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in j = icol(k) ! If any of the neighbours is already assigned, ! we will not reset. + if (j>nr) cycle step1 if (ilaggr(j) > 0) cycle step1 if (abs(val(k)) > theta*sqrt(abs(diag(i)*diag(j)))) then ip = ip + 1