avoid potenttial out-of-bounds memory access

This commit is contained in:
Philip Eisenlohr 2022-10-27 15:56:59 -04:00
parent 5c688345ed
commit c507e2d3b6
1 changed files with 6 additions and 2 deletions

View File

@ -252,9 +252,13 @@ pure function IO_lc(string)
integer :: i,n integer :: i,n
do i=1,len(string) do i = 1,len(string)
n = index(UPPER,string(i:i)) n = index(UPPER,string(i:i))
IO_lc(i:i) = merge(string(i:i),LOWER(n:n),n==0) if (n==0) then
IO_lc(i:i) = string(i:i)
else
IO_lc(i:i) = LOWER(n:n)
end if
end do end do
end function IO_lc end function IO_lc