Bug 433398 - RKWard segmentation faulted in QString::isEmpty when closing
Summary: RKWard segmentation faulted in QString::isEmpty when closing
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-21 18:17 UTC by Matt Fagnani
Modified: 2022-06-16 07:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Fagnani 2021-02-21 18:17:49 UTC
SUMMARY

I was using a Fedora 34 KDE Plasma installation with Plasma 5.21.0 on Wayland. I updated the system with sudo dnf upgrade. The update included R-4.0.4-1.fc34.x86_64 and rkward-0.7.2-2.fc34.x86_64. I rebooted and logged in to Plasma on Wayland. I started RKWard and selected Start with an empty workspace and OK. I closed RKWard by clicking the x button at the top right and selecting Discard in the box with Quitting RKWard: Do you want to save the workspace? RKWard segmentation faulted in QString::isEmpty at ../../include/QtCore/../../src/corelib/text/qstring.h:1078 in qt5-qtbase-5.15.2-13.fc34.x86_64 when closing.

Core was generated by `/usr/libexec/rkward.rbackend --debug-level=3 --server-name=%2Ftmp%2FrkwardLHFpQ'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f39e74bcd3b in QString::isEmpty (this=<optimized out>) at ../../include/QtCore/../../src/corelib/text/qstring.h:1078
1078    ../../include/QtCore/../../src/corelib/text/qstring.h: No such file or directory.
[Current thread is 1 (Thread 0x7f39b2f87640 (LWP 15055))]

(gdb) bt
#0  0x00007f39e74bcd3b in QString::isEmpty (this=<optimized out>)
    at ../../include/QtCore/../../src/corelib/text/qstring.h:1078
#1  QIODevice::errorString (this=0x0) at io/qiodevice.cpp:2102
#2  0x00005652fe39e2e6 in RKAbstractTransmitter::disconnected (this=0x7ffc50159bd0)
    at /usr/src/debug/rkward-0.7.2-2.fc34.x86_64/rkward/rbackend/rktransmitter.cpp:270
#3  0x00007f39e75874b0 in QtPrivate::QSlotObjectBase::call (a=0x7f39b2f85dd0, r=<optimized out>, 
    this=0x7f39ac006560) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#4  doActivate<false> (sender=0x7f39ac0051f0, signal_index=10, argv=0x7f39b2f85dd0)
    at kernel/qobject.cpp:3886
#5  0x00007f39e75874fd in doActivate<false> (sender=0x7f39ac0052d0, signal_index=11, 
    argv=0x7f39b2f85ea0) at kernel/qobject.cpp:3898
#6  0x00007f39e75819e7 in QMetaObject::activate (sender=sender@entry=0x7f39ac0052d0, 
    m=m@entry=0x7f39e7a14d80 <QAbstractSocket::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x0) at kernel/qobject.cpp:3946
#7  0x00007f39e796edf7 in QAbstractSocket::disconnected (this=this@entry=0x7f39ac0052d0)
    at .moc/moc_qabstractsocket.cpp:404
#8  0x00007f39e796f6c1 in QAbstractSocket::disconnectFromHost (this=0x7f39ac0052d0)
    at socket/qabstractsocket.cpp:2814
#9  0x00005652fe3a1ceb in RKRBackendTransmitter::doExit (this=0x7ffc50159bd0)
    at /usr/src/debug/rkward-0.7.2-2.fc34.x86_64/rkward/rbackend/rkbackendtransmitter.cpp:79
#10 0x00007f39e757e257 in QObject::event (this=0x7ffc50159bd0, e=0x56530012be90)
    at kernel/qobject.cpp:1314
#11 0x00007f39e7556f2b in doNotify (event=0x56530012be90, receiver=0x7ffc50159bd0)
    at kernel/qcoreapplication.cpp:1153
#12 QCoreApplication::notify (event=<optimized out>, receiver=<optimized out>, this=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--c
    at kernel/qcoreapplication.cpp:1139
#13 QCoreApplication::notifyInternal2 (receiver=0x7ffc50159bd0, event=0x56530012be90) at kernel/qcoreapplication.cpp:1063
#14 0x00007f39e7559c76 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x5652ff71d4e0) at kernel/qcoreapplication.cpp:1817
#15 0x00007f39e75a3c57 in postEventSourceDispatch (s=s@entry=0x7f39ac004fe0) at kernel/qeventdispatcher_glib.cpp:277
#16 0x00007f39e5ced0ff in g_main_dispatch (context=0x7f39ac000c20) at ../glib/gmain.c:3337
#17 g_main_context_dispatch (context=0x7f39ac000c20) at ../glib/gmain.c:4055
#18 0x00007f39e5d40c98 in g_main_context_iterate.constprop.0 (context=context@entry=0x7f39ac000c20, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4131
#19 0x00007f39e5cea9f3 in g_main_context_iteration (context=0x7f39ac000c20, may_block=1) at ../glib/gmain.c:4196
#20 0x00007f39e75a36f8 in QEventDispatcherGlib::processEvents (this=0x7f39ac000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#21 0x00007f39e75559b2 in QEventLoop::exec (this=this@entry=0x7f39b2f862b0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#22 0x00007f39e73bd49a in QThread::exec (this=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#23 0x00007f39e73be751 in QThreadPrivate::start (arg=0x7ffc50159bd0) at thread/qthread_unix.cpp:329
#24 0x00007f39e7a29269 in start_thread (arg=0x7f39b2f87640) at pthread_create.c:473
#25 0x00007f39e6fe8663 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

RKWard 0.7.2 crashed in this way 7 of 7 times I've closed it. The first 5 core dumps were truncated. The trace above is from the sixth crash. The pointer this=0x0 in frame #1 in QIODevice::errorString at io/qiodevice.cpp:2102 might indicate that a null pointer dereference d->errorString.isEmpty() happened.

(gdb) l io/qiodevice.cpp:2102
file: "../../corelib/io/qiodevice.cpp", line number: 2102, symbol: "???"
2097    ../../corelib/io/qiodevice.cpp: No such file or directory.
file: "/usr/src/debug/qt5-qtbase-5.15.2-13.fc34.x86_64/src/corelib/io/qiodevice.cpp", line number: 2102, symbol: "???"
2097        \sa setErrorString()
2098    */
2099    QString QIODevice::errorString() const
2100    {
2101        Q_D(const QIODevice);
2102        if (d->errorString.isEmpty()) {
2103    #ifdef QT_NO_QOBJECT
2104            return QLatin1String(QT_TRANSLATE_NOOP(QIODevice, "Unknown error"));
2105    #else
2106            return tr("Unknown error");


STEPS TO REPRODUCE
1. Boot a Fedora 34 KDE Plasma installation updated to 2021-2-21. 
2. Install or upgrade to R-4.0.4-1.fc34.x86_64 and rkward-0.7.2-2.fc34.x86_64 
3. Reboot
4. log in to Plasma 5.21.0 on Wayland
5. start RKWard 
6. select Start with an empty workspace 
7. select OK 
8. close RKWard by clicking the x button at the top right 
9. select Discard in the box Quitting RKWard: Do you want to save the workspace?

OBSERVED RESULT
RKWard segmentation faulted in QString::isEmpty when closing

EXPECTED RESULT
RKWard would close normally without the segmentation fault.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 34
(available in About System)
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
Comment 1 Thomas Friedrichsmeier 2022-06-16 07:07:41 UTC
Several cases of undefined behavior on exit have been fixed, meanwhile, and I believe this to be fixed. Should you see the problem again, please open a new ticket.