fix: avoid out-of-bounds caused by wrong or malitious start_irr in ph input

This commit is contained in:
Pietro Delugas 2024-09-18 11:04:48 +02:00
parent 6dde141960
commit c76d199450
1 changed files with 2 additions and 2 deletions

View File

@ -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
END SUBROUTINE set_local_atomo