Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7.2
-
None
-
Operating System: openSUSE Tumbleweed 20240929
KDE Plasma Version: 6.1.90
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.11.0-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 30.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: Eluktronics
Product Name: THINN-15Operating System: openSUSE Tumbleweed 20240929 KDE Plasma Version: 6.1.90 KDE Frameworks Version: 6.7.0 Qt Version: 6.7.2 Kernel Version: 6.11.0-1-default (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics Memory: 30.8 GiB of RAM Graphics Processor: AMD Radeon Graphics Manufacturer: Eluktronics Product Name: THINN-15
-
2
-
9e749df87 (dev), 2739c5974 (dev), 38b8c1535 (6.8)
-
Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118
Description
When a QDateTime's timezone is invalid (e.g., /etc/localtime is missing on Linux), QCalendarBackend::dateTimeToString crashes at line 3662 (Qt 6.7.2 source) when you try to use QLocale::toString on the QDateTime.
This is the part where the crash happens:
text = (text.size() == 3 ? u"+00:00"_s : (text.size() <= 6 // Whole-hour offsets may lack the zero minutes: ? QStringView{text}.sliced(3) + ":00"_L1 : std::move(text).sliced(3)));
I think the issue is that the code assumes text will not be a string with less than 3 characters.
Full backtrace of Spectacle (KDE screenshot app) when the crash occurs while calling QLocale::toString on a QDateTime:
#0 __memcpy_avx_unaligned () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:220 #1 0x00007ffff3538a2b in memcpy (__len=<optimized out>, __src=<optimized out>, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:29 #2 QConcatenable<QStringView>::appendTo (a=..., out=@0x7fffffffc5e8: 0x671388 <QString::_empty@Qt_6>) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/text/qstringbuilder.h:271 #3 0x00007ffff3640696 in QConcatenable<QStringBuilder<QStringView, QLatin1String> >::appendTo<QChar> (out=@0x7fffffffc5e8: 0x671388 <QString::_empty@Qt_6>, p=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/text/qstringbuilder.h:397 #4 QStringBuilder<QStringView, QLatin1String>::convertTo<QString> (this=0x7fffffffc660) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/text/qstringbuilder.h:113 #5 QStringBuilder<QStringView, QLatin1String>::operator QString (this=0x7fffffffc660) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/text/qstringbuilder.h:130 #6 QCalendarBackend::dateTimeToString (this=0xa8f5c0, format=..., datetime=..., dateOnly=..., timeOnly=..., locale=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/text/qlocale.cpp:3662 #7 0x00007ffff3674f90 in QCalendar::dateTimeToString (this=<optimized out>, format=..., datetime=<optimized out>, dateOnly=..., timeOnly=..., locale=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/time/qcalendar.cpp:1668 #8 0x00007ffff363de6a in QLocale::toString (this=this@entry=0x7fffffffc880, dateTime=..., format=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/time/qdatetime.h:174 #9 0x0000000000459cb8 in ExportManager::formattedFilename (nameTemplate=..., timestamp=..., windowTitle=..., saveLocation=...) at /home/noah/kde/src/graphics/spectacle/src/ExportManager.cpp:279 #10 0x000000000045b697 in ExportManager::getAutosaveFilename (this=this@entry=0x681320 <ExportManager::instance()::instance>) at /usr/include/qt6/QtCore/qarraydata.h:59 #11 0x0000000000461b05 in ExportManager::exportImage (this=this@entry=0x681320 <ExportManager::instance()::instance>, actions=..., url=...) at /home/noah/kde/src/graphics/spectacle/src/ExportManager.cpp:692 #12 0x000000000046d01e in operator() (__closure=0xa40290, image=<optimized out>) at /home/noah/kde/src/graphics/spectacle/src/SpectacleCore.cpp:180 #13 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<const QImage&>, void, SpectacleCore::SpectacleCore(QObject*)::<lambda(const QImage&)> >::call (f=..., arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137 #14 QtPrivate::FunctorCallable<SpectacleCore::SpectacleCore(QObject*)::<lambda(const QImage&)>, const QImage&>::call<QtPrivate::List<QImage const&>, void> (f=..., arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:345 #15 QtPrivate::QCallableObject<SpectacleCore::SpectacleCore(QObject*)::<lambda(const QImage&)>, QtPrivate::List<const QImage&>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0xa40280, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:555 #16 0x00007ffff35e7f90 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffcdd0, r=0x7fffffffd5d0, this=0xa40280) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qobjectdefs_impl.h:469 #17 doActivate<false> (sender=0xa3f890, signal_index=4, argv=0x7fffffffcdd0) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qobject.cpp:4086 #18 0x00000000004b9e23 in ImagePlatform::newScreenshotTaken (this=this@entry=0xa3f890, _t1=...) at /home/noah/kde6/build/graphics/spectacle/src/spectacle_autogen/include/moc_ImagePlatform.cpp:282 #19 0x00000000004d00b0 in ImagePlatformKWin::trackSource<void (ImagePlatform::*)(QImage const&)>(ScreenShotSourceMeta2*, void (ImagePlatform::*)(QImage const&))::{lambda(QList<ResultVariant> const&)#1}::operator()(QList<ResultVariant> const&) const (__closure=0xa0e930, results=<optimized out>) at /home/noah/kde/src/graphics/spectacle/src/Platforms/ImagePlatformKWin.cpp:488 #20 0x00007ffff35e7f90 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffcff0, r=0xa3f890, this=0xa0e920) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qobjectdefs_impl.h:469 #21 doActivate<false> (sender=0xa3c530, signal_index=3, argv=0x7fffffffcff0) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qobject.cpp:4086 #22 0x00000000004bddec in ScreenShotSourceMeta2::finished (this=<optimized out>, _t1=<optimized out>) at /home/noah/kde6/build/graphics/spectacle/src/spectacle_autogen/include/moc_ImagePlatformKWin.cpp:699 #23 operator() (__closure=0xa3bf00, result=<optimized out>) at /home/noah/kde/src/graphics/spectacle/src/Platforms/ImagePlatformKWin.cpp:362 #24 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<const ResultVariant&>, void, ScreenShotSourceMeta2::ScreenShotSourceMeta2(QVector<ScreenShotSource2*>&)::<lambda(const ResultVariant&)> >::call (f=..., arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:137 #25 QtPrivate::FunctorCallable<ScreenShotSourceMeta2::ScreenShotSourceMeta2(QVector<ScreenShotSource2*>&)::<lambda(const ResultVariant&)>, const ResultVariant&>::call<QtPrivate::List<ResultVariant const&>, void> (f=..., arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:345 #26 QtPrivate::QCallableObject<ScreenShotSourceMeta2::ScreenShotSourceMeta2(QVector<ScreenShotSource2*>&)::<lambda(const ResultVariant&)>, QtPrivate::List<const ResultVariant&>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0xa3bef0, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:555 #27 0x00007ffff35d1e1b in QObject::event (this=0xa3c530, e=0x7fff180019b0) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qobject.cpp:1452 #28 0x00007ffff55c2f6e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0xa3c530, e=0x7fff180019b0) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/widgets/kernel/qapplication.cpp:3287 #29 0x00007ffff358ec30 in QCoreApplication::notifyInternal2 (receiver=0xa3c530, event=0x7fff180019b0) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qcoreapplication.cpp:1142 #30 0x00007ffff358ec69 in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qcoreapplication.cpp:1583 #31 0x00007ffff358ef90 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x703f00) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qcoreapplication.cpp:1940 #32 0x00007ffff37c2fe3 in postEventSourceDispatch (s=0x7e8960) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qeventdispatcher_glib.cpp:244 #33 0x00007ffff0110fb8 in g_main_dispatch (context=0x7fff5c000f00) at ../glib/gmain.c:3344 #34 g_main_context_dispatch_unlocked (context=context@entry=0x7fff5c000f00) at ../glib/gmain.c:4152 #35 0x00007ffff0112d38 in g_main_context_iterate_unlocked (context=context@entry=0x7fff5c000f00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217 #36 0x00007ffff01133ec in g_main_context_iteration (context=0x7fff5c000f00, may_block=1) at ../glib/gmain.c:4282 #37 0x00007ffff37c1adc in QEventDispatcherGlib::processEvents (this=0x697fd0, flags=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/kernel/qeventdispatcher_glib.cpp:394 #38 0x00007ffff35993db in QEventLoop::exec (this=0x7fffffffd3f0, flags=...) at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/global/qflags.h:34 #39 0x00007ffff3592bb6 in QCoreApplication::exec () at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/corelib/global/qflags.h:74 #40 0x00007ffff49e7dec in QGuiApplication::exec () at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/gui/kernel/qguiapplication.cpp:1926 #41 0x00007ffff55bfff5 in QApplication::exec () at /usr/src/debug/qtbase-everywhere-src-6.7.2/src/widgets/kernel/qapplication.cpp:2555 #42 0x0000000000438fd7 in main (argc=<optimized out>, argv=<optimized out>) at /home/noah/kde/src/graphics/spectacle/src/Main.cpp:100