https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99148
Bug ID: 99148
Summary: sanitizer detects stack-buffer-overflow in
unpack_generic.c
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Target Milestone: ---
! from char_length_8.f90
! address sanitizer detects stack-buffer-overflow in libgfortran
! Must compile libgfortran with -fsanitize=address and link it
! must appear in ldd a.out as in
! libgfortran.so.5 =>
/home/vitti/local/gcc-150221-address/lib64/libgfortran.so.5
(0x000015384c110000)
! compile with "gfortran p.f90 -g"
! execute with "LD_PRELOAD=/lib64/libasan.so.6 ./a.out"
!==32152==ERROR: AddressSanitizer: stack-buffer-overflow on address
0x7ffdd7a7e6a8 at pc 0x14916720908b bp 0x7ffdd7a7e210 sp 0x7ffdd7a7e208
!READ of size 8 at 0x7ffdd7a7e6a8 thread T0
! #0 0x14916720908a in unpack_internal
../../../gcc-150221/libgfortran/intrinsics/unpack_generic.c:122
! "fstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(field, n);"
CHARACTER(LEN=3), DIMENSION(10) :: Z
logical, dimension(5,2) :: mask
Z(:)="hij"
mask = .true.
if (any (unpack(Z(:)(2:2),mask,' ') .ne. "i")) STOP 8
END