https://bugs.kde.org/show_bug.cgi?id=524285
Bug ID: 524285
Summary: Segfault at EncryptedAuthenticate destructor
Classification: Applications
Product: ktorrent
Version First unspecified
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: crash
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
DESCRIPTION
KTorrent crashes with a segfault when running for long enough.
Dumped core suggests segfault in mse::EncryptedAuthenticate destructor.
STEPS TO REPRODUCE
1. Run KTorrent
2. Load some torrents
3. Wait
OBSERVED RESULT
Crash with segfault
EXPECTED RESULT
No segfault no crash
SOFTWARE/OS VERSIONS
libktorrent ee7a93597959eab24883c9e88b33226495ba9593
ktorrent 1138f3d38e2ddc80c6f4d28f999cd2b84f168b66
Operating System: EndeavourOS
KDE Plasma Version: 6.7.3
KDE Frameworks Version: 6.28.0
Qt Version: 6.11.1
Kernel Version: 7.1.5-arch1-1 (64-bit)
Graphics Platform: Wayland
ADDITIONAL INFORMATION
With libktorrent built with ASAN and the following diff:
```
diff --git a/src/mse/encryptedauthenticate.cpp
b/src/mse/encryptedauthenticate.cpp
index fbc507e9..35cbf6a1 100644
--- a/src/mse/encryptedauthenticate.cpp
+++ b/src/mse/encryptedauthenticate.cpp
@@ -19,6 +19,9 @@
#include <util/functions.h>
#include <util/log.h>
+#include <QDebug>
+#include <QDateTime>
+
using namespace bt;
namespace mse
@@ -39,10 +42,12 @@ EncryptedAuthenticate::EncryptedAuthenticate(const
net::Address &addr,
pad_D_len = 0;
end_of_crypto_handshake = 0;
// Out(SYS_CON|LOG_DEBUG) << "EncryptedAuthenticate : " << ip << ":" <<
port << endl;
+ qDebug () << QDateTime::currentDateTime() << __PRETTY_FUNCTION__ << this;
}
EncryptedAuthenticate::~EncryptedAuthenticate()
{
+ qDebug () << QDateTime::currentDateTime() << __PRETTY_FUNCTION__ << this;
}
void EncryptedAuthenticate::connected()
diff --git a/src/mse/encryptedauthenticate.h b/src/mse/encryptedauthenticate.h
index cc5be806..f8316bb8 100644
--- a/src/mse/encryptedauthenticate.h
+++ b/src/mse/encryptedauthenticate.h
@@ -25,7 +25,7 @@ const bt::Uint32 MAX_EA_BUF_SIZE = 622 + 512;
*
* \brief RC4 encrypted version of the Authenticate class.
*/
-class EncryptedAuthenticate : public bt::Authenticate
+class EncryptedAuthenticate final : public bt::Authenticate
{
Q_OBJECT
public:
```
(The "final" was just to be sure my assumptions were correct)
I got the following output at the end (with relevant context):
```
QDateTime(2026-08-15 14:14:01.947 IST Qt::LocalTime)
mse::EncryptedAuthenticate::EncryptedAuthenticate(const net::Address&,
bt::TransportProtocol, const bt::SHA1Hash&, const bt::PeerID&,
bt::PeerConnector::WPtr) mse::EncryptedAuthenticate(0x7d85c2750880)
...
QDateTime(2026-08-15 14:14:05.197 IST Qt::LocalTime) virtual
mse::EncryptedAuthenticate::~EncryptedAuthenticate()
mse::EncryptedAuthenticate(0x7d85c2750880)
AddressSanitizer: CHECK failed: asan_allocator.cpp:191 "((old)) ==
((kAllocBegMagic))" (0xffff010000000000, 0xcc6e96b9cc6e96b9) (tid=499706)
#0 0x7fd5cd93a39e (/usr/lib/libasan.so.8+0x13a39e) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#1 0x7fd5cd9674e3 (/usr/lib/libasan.so.8+0x1674e3) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#2 0x7fd5cd843e4e (/usr/lib/libasan.so.8+0x43e4e) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#3 0x7fd5cd843f7e (/usr/lib/libasan.so.8+0x43f7e) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#4 0x7fd5cd84449b (/usr/lib/libasan.so.8+0x4449b) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#5 0x7fd5cd84475a (/usr/lib/libasan.so.8+0x4475a) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#6 0x7fd5cd92ae54 (/usr/lib/libasan.so.8+0x12ae54) (BuildId:
e0eae949e1bd01f14ec9255abb8355d77da26d84)
#7 0x7bd4c9f7b14f
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x2314f)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#8 0x7bd4c9f79c33
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x21c33)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#9 0x7bd4c9f7927d
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x2127d)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#10 0x7bd4c9f7565d
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x1d65d)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#11 0x7bd4c9f76baf
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x1ebaf)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#12 0x7bd4c9f8baa4
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x33aa4)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#13 0x7bd4c9f822d7
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent_plugins/StatsPlugin.so+0x2a2d7)
(BuildId: aa1c6696cf042007985f0175ef89e3e713218986)
#14 0x7fd5cd78e859 in kt::PluginManager::updateGuiPlugins()
/run/media/ulterno/Data/code/KDE/KTorrent/ktorrent/libktcore/plugin/pluginmanager.cpp:153
#15 0x557982443b9b in kt::Core::updateGuiPlugins()
/run/media/ulterno/Data/code/KDE/KTorrent/ktorrent/ktorrent/core.cpp:1199
#16 0x557982463126 in kt::GUI::update()
/run/media/ulterno/Data/code/KDE/KTorrent/ktorrent/ktorrent/gui.cpp:438
#17 0x557982467657 in QtPrivate::FunctorCall<std::integer_sequence<unsigned
long>, QtPrivate::List<>, void, void (kt::GUI::*)()>::call(void (kt::GUI::*)(),
kt::GUI*, void**)::{lambda()#1}::operator()() const
/usr/include/qt6/QtCore/qobjectdefs_impl.h:128
#18 0x557982467a2e in void QtPrivate::FunctorCallBase::call_internal<void,
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>,
void, void (kt::GUI::*)()>::call(void (kt::GUI::*)(), kt::GUI*,
void**)::{lambda()#1}>(void**,
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>,
void, void (kt::GUI::*)()>::call(void (kt::GUI::*)(), kt::GUI*,
void**)::{lambda()#1}&&) /usr/include/qt6/QtCore/qobjectdefs_impl.h:66
#19 0x5579824676c9 in QtPrivate::FunctorCall<std::integer_sequence<unsigned
long>, QtPrivate::List<>, void, void (kt::GUI::*)()>::call(void (kt::GUI::*)(),
kt::GUI*, void**) /usr/include/qt6/QtCore/qobjectdefs_impl.h:127
#20 0x5579824672a1 in void QtPrivate::FunctionPointer<void
(kt::GUI::*)()>::call<QtPrivate::List<>, void>(void (kt::GUI::*)(), kt::GUI*,
void**) /usr/include/qt6/QtCore/qobjectdefs_impl.h:175
#21 0x557982466de4 in QtPrivate::QCallableObject<void (kt::GUI::*)(),
QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*,
void**, bool*) /usr/include/qt6/QtCore/qobjectdefs_impl.h:546
#22 0x7fd5c8ff081a in QtPrivate::QSlotObjectBase::call(QObject*, void**)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:462
#23 0x7fd5c8ff081a in void doActivate<false>(QObject*, int, void**)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4372
#24 0x7fd5c900224e in void QMetaObject::activate<void,
QTimer::QPrivateSignal>(QObject*, QMetaObject const*, int, void*,
QTimer::QPrivateSignal const&)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs.h:320
#25 0x7fd5c900224e in QTimer::timeout(QTimer::QPrivateSignal)
/usr/src/debug/qt6-base/build/src/corelib/Core_autogen/include/moc_qtimer.cpp:182
#26 0x7fd5c900224e in QTimer::timerEvent(QTimerEvent*)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimer.cpp:332
#27 0x7fd5c900224e in QTimer::timerEvent(QTimerEvent*)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimer.cpp:326
#28 0x7fd5c8fe7cf8 in QObject::event(QEvent*)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1454
#29 0x7fd5ca10411e in QApplicationPrivate::notify_helper(QObject*, QEvent*)
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3276
#30 0x7fd5c8f83657 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1114
#31 0x7fd5c916b2f4 in QCoreApplication::sendEvent(QObject*, QEvent*)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1559
#32 0x7fd5c916b2f4 in QTimerInfoList::activateTimers()
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimerinfo_unix.cpp:427
#33 0x7fd5c929fc18 in timerSourceDispatch
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:153
#34 0x7fd5c613ebfc (/usr/lib/libglib-2.0.so.0+0x61bfc) (BuildId:
6d161c3dc593ef99967915cfe1c4b48d96841477)
#35 0x7fd5c6140e56 (/usr/lib/libglib-2.0.so.0+0x63e56) (BuildId:
6d161c3dc593ef99967915cfe1c4b48d96841477)
#36 0x7fd5c6140fe4 in g_main_context_iteration
(/usr/lib/libglib-2.0.so.0+0x63fe4) (BuildId:
6d161c3dc593ef99967915cfe1c4b48d96841477)
#37 0x7fd5c929d0b1 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:402
#38 0x7fd5c8f91982 in
QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:109
#39 0x7fd5c8f91982 in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:198
#40 0x7fd5c8f86ea9 in QCoreApplication::exec()
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1457
#41 0x55798243540e in main
/run/media/ulterno/Data/code/KDE/KTorrent/ktorrent/ktorrent/main.cpp:261
#42 0x7fd5c8627780 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:59
#43 0x7fd5c86278b8 in __libc_start_main_impl ../csu/libc-start.c:372
#44 0x557982429094 in _start
(/run/media/ulterno/Data/code/KDE/KTorrent/install/bin/ktorrent+0x42094)
(BuildId: a98412fa34c4fa744d5c768597d2e3bb1bc1203f)
```
--
You are receiving this mail because:
You are watching all bug changes.