https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83118

--- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Compiling the reduced test

type :: any_vector
  class(*), allocatable :: v(:)
end type
type(any_vector) :: x, y
x%v = ['foo','bar']
end

with -fsanitize=address gives

==54286==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x602000000150 at pc 0x000102fb38df bp 0x7ffeecc4d180 sp 0x7ffeecc4d178
READ of size 8 at 0x602000000150 thread T0
    #0 0x102fb38de in MAIN__ (a.out:x86_64+0x1000018de)
    #1 0x102fb3b9a in main (a.out:x86_64+0x100001b9a)
    #2 0x7fff7512bed8 in start (libdyld.dylib:x86_64+0x16ed8)

0x602000000156 is located 0 bytes to the right of 6-byte region
[0x602000000150,0x602000000156)
allocated by thread T0 here:
    #0 0x1032e784f in wrap_malloc sanitizer_malloc_mac.inc:114
    #1 0x102fb37b3 in MAIN__ (a.out:x86_64+0x1000017b3)
    #2 0x102fb3b9a in main (a.out:x86_64+0x100001b9a)
    #3 0x7fff7512bed8 in start (libdyld.dylib:x86_64+0x16ed8)

SUMMARY: AddressSanitizer: heap-buffer-overflow (a.out:x86_64+0x1000018de) in
MAIN__
Shadow bytes around the buggy address:
  0x1c03ffffffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03fffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c0400000000: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 07
  0x1c0400000010: fa fa 03 fa fa fa 00 00 fa fa 00 06 fa fa 06 fa
=>0x1c0400000020: fa fa 07 fa fa fa 07 fa fa fa[06]fa fa fa fa fa
  0x1c0400000030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc

Reply via email to