From c76d19945030190b9585e86aa7efa7e895199b50 Mon Sep 17 00:00:00 2001 From: Pietro Delugas Date: Wed, 18 Sep 2024 11:04:48 +0200 Subject: [PATCH] fix: avoid out-of-bounds caused by wrong or malitious start_irr in ph input --- PHonon/PH/check_if_partial_dyn.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PHonon/PH/check_if_partial_dyn.f90 b/PHonon/PH/check_if_partial_dyn.f90 index 8075c9443..b17caa866 100644 --- a/PHonon/PH/check_if_partial_dyn.f90 +++ b/PHonon/PH/check_if_partial_dyn.f90 @@ -93,7 +93,7 @@ INTEGER :: last_irr_eff ! last_irr_eff=last_irr IF (last_irr > nirr.or.last_irr<0) last_irr_eff=nirr - IF (start_irr > 1) comp_irr(0:start_irr-1) = .FALSE. + IF (start_irr > 1) comp_irr(0:min(start_irr-1,nirr)) = .FALSE. IF (last_irr_eff < nirr ) comp_irr(last_irr_eff+1:nirr) = .FALSE. ! @@ -164,4 +164,4 @@ SUBROUTINE set_local_atomo(nat, nat_todo, atomo, nsym, irt, nat_l, atomo_l) ALLOCATE (atomo_l(nat_l)) atomo_l = PACK([(na,na=1,nat)], MASK = ifat == 1) DEALLOCATE(ifat) -END SUBROUTINE set_local_atomo \ No newline at end of file +END SUBROUTINE set_local_atomo