msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.27k stars 1.22k forks source link

Qt 6.8.0: crash on `QTime::fromString` #22308

Open BLumia opened 4 hours ago

BLumia commented 4 hours ago

Description / Steps to reproduce the issue

Save the following two code snipes to local:

CMakeLists.txt

cmake_minimum_required (VERSION 3.9.5)

project (testbug)

set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)

set (QT_MINIMUM_VERSION "6.8")

find_package(Qt6 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core)

set (EXE_NAME testbug)

add_executable (${EXE_NAME}
    main.cpp
)

target_link_libraries (${EXE_NAME} Qt6::Core)

main.cpp

#include <QCoreApplication>
#include <QTime>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QTime timestamp(QTime::fromString("00:00.000", "m:s.zz"));
    qDebug() << "not crashed";

    return a.exec();
}

Steps:

  1. Use Qt Creator to open CMakeLists.txt as project and compile this project (or you can also build it manually)
  2. Run the program.
  3. See the crash (if you choose to run it manually, not seeing the "not crashed" line will be the bug)

Additionally, only MSYS2's Qt have this issue currently, Qt's official Qt 6.8.0 binaries (both msvc and mingw) don't have this issue.

Qt version:

% LANG=C pacman -Qi mingw-w64-ucrt-x86_64-qt6-base
Name            : mingw-w64-ucrt-x86_64-qt6-base
Version         : 6.8.0-1
Description     : A cross-platform application and UI framework (mingw-w64)
Architecture    : any
URL             : https://www.qt.io
Licenses        : spdx:LGPL-3.0-only WITH Qt-GPL-exception-1.0 AND AFL-2.1 AND Apache-2.0 AND BSL-1.0 AND CC0-1.0 AND BSD-3-Clause AND CC-BY-4.0 AND GFDL-1.3-no-invariants-only AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND custom
Groups          : mingw-w64-ucrt-x86_64-qt6
Provides        : None
Depends On      : mingw-w64-ucrt-x86_64-double-conversion  mingw-w64-ucrt-x86_64-dbus
                  mingw-w64-ucrt-x86_64-freetype  mingw-w64-ucrt-x86_64-glib2  mingw-w64-ucrt-x86_64-harfbuzz
                  mingw-w64-ucrt-x86_64-icu  mingw-w64-ucrt-x86_64-libb2  mingw-w64-ucrt-x86_64-libjpeg-turbo
                  mingw-w64-ucrt-x86_64-libpng  mingw-w64-ucrt-x86_64-md4c  mingw-w64-ucrt-x86_64-openssl
                  mingw-w64-ucrt-x86_64-pcre2  mingw-w64-ucrt-x86_64-sqlite3  mingw-w64-ucrt-x86_64-vulkan-loader
                  mingw-w64-ucrt-x86_64-vulkan-headers  mingw-w64-ucrt-x86_64-zlib  mingw-w64-ucrt-x86_64-zstd
Optional Deps   : mingw-w64-ucrt-x86_64-libmariadbclient: MySQL/MariaDB driver
                  mingw-w64-ucrt-x86_64-postgresql: PostgreSQL driver
                  mingw-w64-ucrt-x86_64-firebird: Firebird/iBase driver
Required By     : mingw-w64-ucrt-x86_64-attica  mingw-w64-ucrt-x86_64-breeze  mingw-w64-ucrt-x86_64-breeze-icons
                  mingw-w64-ucrt-x86_64-elisa  mingw-w64-ucrt-x86_64-gammaray  mingw-w64-ucrt-x86_64-karchive
                  mingw-w64-ucrt-x86_64-kate  mingw-w64-ucrt-x86_64-kauth  mingw-w64-ucrt-x86_64-kbookmarks
                  mingw-w64-ucrt-x86_64-kcmutils  mingw-w64-ucrt-x86_64-kcodecs  mingw-w64-ucrt-x86_64-kcolorscheme
                  mingw-w64-ucrt-x86_64-kcompletion  mingw-w64-ucrt-x86_64-kconfig
                  mingw-w64-ucrt-x86_64-kconfigwidgets  mingw-w64-ucrt-x86_64-kcoreaddons
                  mingw-w64-ucrt-x86_64-kcrash  mingw-w64-ucrt-x86_64-kdbusaddons  mingw-w64-ucrt-x86_64-kdoctools
                  mingw-w64-ucrt-x86_64-kfilemetadata  mingw-w64-ucrt-x86_64-kglobalaccel
                  mingw-w64-ucrt-x86_64-kguiaddons  mingw-w64-ucrt-x86_64-ki18n  mingw-w64-ucrt-x86_64-kiconthemes
                  mingw-w64-ucrt-x86_64-kimageformats  mingw-w64-ucrt-x86_64-kio  mingw-w64-ucrt-x86_64-kirigami
                  mingw-w64-ucrt-x86_64-kirigami-addons  mingw-w64-ucrt-x86_64-kitemmodels
                  mingw-w64-ucrt-x86_64-kitemviews  mingw-w64-ucrt-x86_64-kjobwidgets
                  mingw-w64-ucrt-x86_64-knewstuff  mingw-w64-ucrt-x86_64-knotifications
                  mingw-w64-ucrt-x86_64-knotifyconfig  mingw-w64-ucrt-x86_64-konsole  mingw-w64-ucrt-x86_64-kpackage
                  mingw-w64-ucrt-x86_64-kparts  mingw-w64-ucrt-x86_64-kservice  mingw-w64-ucrt-x86_64-ktexteditor
                  mingw-w64-ucrt-x86_64-ktextwidgets  mingw-w64-ucrt-x86_64-kwallet
                  mingw-w64-ucrt-x86_64-kwidgetsaddons  mingw-w64-ucrt-x86_64-kwindowsystem
                  mingw-w64-ucrt-x86_64-kxmlgui  mingw-w64-ucrt-x86_64-phonon-qt6  mingw-w64-ucrt-x86_64-poppler-qt6
                  mingw-w64-ucrt-x86_64-qca-qt6  mingw-w64-ucrt-x86_64-qqc2-desktop-style
                  mingw-w64-ucrt-x86_64-qscintilla-qt6  mingw-w64-ucrt-x86_64-qt6-5compat
                  mingw-w64-ucrt-x86_64-qt6-declarative  mingw-w64-ucrt-x86_64-qt6-imageformats
                  mingw-w64-ucrt-x86_64-qt6-multimedia  mingw-w64-ucrt-x86_64-qt6-serialport
                  mingw-w64-ucrt-x86_64-qt6-shadertools  mingw-w64-ucrt-x86_64-qt6-speech
                  mingw-w64-ucrt-x86_64-qt6-svg  mingw-w64-ucrt-x86_64-qt6-tools
                  mingw-w64-ucrt-x86_64-qt6-translations  mingw-w64-ucrt-x86_64-qt6-webview
                  mingw-w64-ucrt-x86_64-solid  mingw-w64-ucrt-x86_64-sonnet  mingw-w64-ucrt-x86_64-syndication
                  mingw-w64-ucrt-x86_64-syntax-highlighting  mingw-w64-ucrt-x86_64-threadweaver
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 88.07 MiB
Packager        : CI (msys2/msys2-autobuild/7c56a1d7/11496038242)
Build Date      : Thu Oct 24 17:04:16 2024
Install Date    : Fri Oct 25 20:09:43 2024
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : SHA-256 Sum  Signature

Expected behavior

Not crashed. You can see the not crashed line from the console output.

Actual behavior

Crashed.

Verification

Windows Version

MINGW64_NT-10.0-22631

MINGW environments affected

Are you willing to submit a PR?

No (since I don't know why)

BLumia commented 2 hours ago

Please report the issue to Qt.

Hi @MehdiChinoune , official Qt CANNOT reproduce this issue, this is MSYS2-only issue.

BLumia commented 2 hours ago

I noticed MSYS2 also provided debug symbol package for Qt, so I dig into this bug, seems indeed a Qt bug caused by ICU feature (Qt's official build doesn't have ICU-enabled).

By looking at the crash call stack, seems it caused by stack overflow:

QIcuTimeZonePrivate::data -> QTimeZonePrivate::abbreviation -> QTimeZonePrivate::displayName -> QIcuTimeZonePrivate::data -> ...

image

The bug is reported to upstream: https://bugreports.qt.io/browse/QTBUG-130597

Please consider keeping this issue open though, we might need to apply the fix as a patch to MSYS2's Qt since MSYS2 is affected.