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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2022-11-02
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
=================================================================
==624580==ERROR: AddressSanitizer: heap-use-after-free on address
0x606000000028 at pc 0x0000004042b1 bp 0x7ffe18357490 sp 0x7ffe18357488
READ of size 8 at 0x606000000028 thread T0
    #0 0x4042b0 in std::__n4861::coroutine_handle<Co::promise<Foo,
Co::Task<Foo> > >::destroy() const
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246
    #1 0x403cb7 in Co::UniqueHandle<Co::promise<Foo, Co::Task<Foo> >
>::~UniqueHandle() /tmp/cocrash.cxx:37
    #2 0x403767 in Co::Task<Foo>::~Task() /tmp/cocrash.cxx:135
    #3 0x402a47 in FooC /tmp/cocrash.cxx:171
    #4 0x4018c2 in FooA /tmp/cocrash.cxx:160
    #5 0x402c11 in FooC /tmp/cocrash.cxx:168
    #6 0x403501 in std::__n4861::coroutine_handle<void>::resume() const
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135
    #7 0x402f84 in main /tmp/cocrash.cxx:177
    #8 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f)
    #9 0x7f66323e75c8 in __libc_start_main_impl (/lib64/libc.so.6+0x295c8)
    #10 0x4011b4 in _start (/tmp/a.out+0x4011b4)

0x606000000028 is located 8 bytes inside of 56-byte region
[0x606000000020,0x606000000058)
freed by thread T0 here:
    #0 0x7f66329bcbb8 in operator delete(void*)
../../../../gcc-12.1.0/libsanitizer/asan/asan_new_delete.cpp:152
    #1 0x401981 in FooA /tmp/cocrash.cxx:162
    #2 0x401a38 in FooA /tmp/cocrash.cxx:160
    #3 0x4042b9 in std::__n4861::coroutine_handle<Co::promise<Foo,
Co::Task<Foo> > >::destroy() const
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246
    #4 0x403cb7 in Co::UniqueHandle<Co::promise<Foo, Co::Task<Foo> >
>::~UniqueHandle() /tmp/cocrash.cxx:37
    #5 0x403767 in Co::Task<Foo>::~Task() /tmp/cocrash.cxx:135
    #6 0x4029ff in FooC /tmp/cocrash.cxx:171
    #7 0x4018c2 in FooA /tmp/cocrash.cxx:160
    #8 0x402c11 in FooC /tmp/cocrash.cxx:168
    #9 0x403501 in std::__n4861::coroutine_handle<void>::resume() const
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135
    #10 0x402f84 in main /tmp/cocrash.cxx:177
    #11 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f)

previously allocated by thread T0 here:
    #0 0x7f66329bc178 in operator new(unsigned long)
../../../../gcc-12.1.0/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x40129f in FooA() /tmp/cocrash.cxx:162
    #2 0x4027c2 in FooC /tmp/cocrash.cxx:171
    #3 0x403501 in std::__n4861::coroutine_handle<void>::resume() const
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:135
    #4 0x402f84 in main /tmp/cocrash.cxx:177
    #5 0x7f66323e750f in __libc_start_call_main (/lib64/libc.so.6+0x2950f)

SUMMARY: AddressSanitizer: heap-use-after-free
/home/jwakely/gcc/12.1.0/include/c++/12.1.0/coroutine:246 in
std::__n4861::coroutine_handle<Co::promise<Foo, Co::Task<Foo> > >::destroy()
const
Shadow bytes around the buggy address:
  0x0c0c7fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c0c7fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c0c7fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c0c7fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c0c7fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c0c7fff8000: fa fa fa fa fd[fd]fd fd fd fd fd fa fa fa fa fa
  0x0c0c7fff8010: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff8050: 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
==624580==ABORTING

Reply via email to