Skip to content

HelperSupport: don't send debug message on application shutting down

Fushan Wen requested to merge work/fuf/crash into master

This fixes a use-after-free.

=================================================================
==4549==ERROR: AddressSanitizer: heap-use-after-free on address 0x50c000012640 at pc 0x7f6455545708 bp 0x7fff84016860 sp 0x7fff84016858
READ of size 8 at 0x50c000012640 thread T0
    #0 0x7f6455545707 in KAuth::HelperSupport::helperDebugHandler(QtMsgType, QMessageLogContext const&, QString const&) /builds/frameworks/kauth/src/helpersupport.cpp:129
    #1 0x7f6452b0b4e6 in qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) (/lib64/libQt6Core.so.6+0x1314e6) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
    #2 0x7f6452b158c7 in QDebug::~QDebug() (/lib64/libQt6Core.so.6+0x13b8c7) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
    #3 0x7f6452ddac0b  (/lib64/libQt6Core.so.6+0x400c0b) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
    #4 0x7f6452d9720b  (/lib64/libQt6Core.so.6+0x3bd20b) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
    #5 0x7f64525bf3c0 in __cxa_finalize (/lib64/libc.so.6+0x433c0) (BuildId: a2c0942c27fb9483b47886a1b937337a797bbceb)
    #6 0x7f6452af4186  (/lib64/libQt6Core.so.6+0x11a186) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
0x50c000012640 is located 0 bytes inside of 120-byte region [0x50c000012640,0x50c0000126b8)
freed by thread T0 here:
    #0 0x7f64557191f8 in operator delete(void*, unsigned long) (/usr/lib64/gcc/x86_64-suse-linux/13/libasan.so+0xfe1f8) (BuildId: 6b8377eed7514a2b9b24e752e250df1b9acad9ea)
    #1 0x7f644946ac48 in KAuth::DBusHelperProxy::~DBusHelperProxy() /builds/frameworks/kauth/src/backends/dbus/DBusHelperProxy.cpp:44
    #2 0x7f6452ddaa98  (/lib64/libQt6Core.so.6+0x400a98) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
previously allocated by thread T0 here:
    #0 0x7f64557182f8 in operator new(unsigned long) (/usr/lib64/gcc/x86_64-suse-linux/13/libasan.so+0xfd2f8) (BuildId: 6b8377eed7514a2b9b24e752e250df1b9acad9ea)
    #1 0x7f644947611a in qt_plugin_instance /builds/frameworks/kauth/_build/src/kauth_helper_plugin_autogen/include/moc_DBusHelperProxy.cpp:202
    #2 0x7f6452d99af0  (/lib64/libQt6Core.so.6+0x3bfaf0) (BuildId: b08c7df7d9504a493ca888419658ddf2ba882e48)
SUMMARY: AddressSanitizer: heap-use-after-free /builds/frameworks/kauth/src/helpersupport.cpp:129 in KAuth::HelperSupport::helperDebugHandler(QtMsgType, QMessageLogContext const&, QString const&)
Shadow bytes around the buggy address:
  0x50c000012380: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x50c000012400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x50c000012480: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x50c000012500: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x50c000012580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
=>0x50c000012600: fa fa fa fa fa fa fa fa[fd]fd fd fd fd fd fd fd
  0x50c000012680: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x50c000012700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x50c000012780: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x50c000012800: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x50c000012880: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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
==4549==ABORTING
======================================================================

Merge request reports