Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97486

Crash in TimeZone ICU backend

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.11, 6.2.1, 6.3.0 Alpha
    • 6.2.0
    • Core: Date/Time
    • None
    • Qt 6.2.0 with ICU 69.1, Windows 10, MSVC 2019
    • Windows
    • f83a3c4b6e703d3d6b48f2f8d2f71ab69c084b8f (qt/qtbase/dev) 367ef5cebde581c9da9f78f703d8606237d252c7 (qt/qtbase/6.2.1) f6f6a958058fc7de2cc39a7be84c605a80bc01d0 (qt/qtbase/6.2) 0d34496d87 (qt/tqtc-qtbase/5.15) 7065fe1625 (qt/tqtc-qtbase/5.15)

    Description

      There is custom built Qt 6.2.0 (MSVC 2019) with ICU support.

      It was configured this way:

      configure -icu -- -DCMAKE_PREFIX_PATH=%icu4c_install_path%
      

      and was built against ICU 69.1

      Unhandled exception at 0x00007FFBDECF26DC (ucrtbased.dll) : 0xC0000005: Access violation reading location 0x00000192FBED5000.

      Crash stack:

       	ucrtbased.dll!common_strnlen_simd<1,1,unsigned short>(const unsigned short * const string, const unsigned __int64 maximum_count) Line 152	C++
       	ucrtbased.dll!common_strnlen<1,unsigned short>(const unsigned short * const string, const unsigned __int64 maximum_count) Line 185	C++
       	ucrtbased.dll!wcslen(const wchar_t * string) Line 221	C++
       	icuuc69d.dll!u_strlen_69(const char16_t * s) Line 1005	C++
       	icuin69d.dll!_createTimeZone(const char16_t * zoneID, int len, UErrorCode * ec) Line 41	C++
       	icuin69d.dll!ucal_getDSTSavings_69(const char16_t * zoneID, UErrorCode * ec) Line 114	C++
       	Qt6Cored.dll!ucalDaylightOffset(const QByteArray & id) Line 267	C++
      >	Qt6Cored.dll!QIcuTimeZonePrivate::hasDaylightTime() Line 382	C++
       	Qt6Cored.dll!QTimeZonePrivate::dataForLocalTime(__int64 forLocalMSecs, int hint) Line 269	C++
       	Qt6Cored.dll!QDateTimePrivate::zoneMSecsToEpochMSecs(__int64 zoneMSecs, const QTimeZone & zone, QDateTimePrivate::DaylightStatus * hint, QDate * zoneDate, QTime * zoneTime, QString * abbreviation) Line 3299	C++
       	Qt6Cored.dll!QDateTimePrivate::localMSecsToEpochMSecs(__int64 localMsecs, QDateTimePrivate::DaylightStatus * daylightStatus, QDate * localDate, QTime * localTime, QString * abbreviation) Line 2789	C++
       	Qt6Cored.dll!refreshZonedDateTime(QDateTime::Data & d, Qt::TimeSpec spec) Line 2949	C++
       	Qt6Cored.dll!QDateTimePrivate::create(QDate toDate, QTime toTime, Qt::TimeSpec toSpec, int offsetSeconds) Line 3272	C++
       	Qt6Cored.dll!QDateTime::QDateTime(QDate date, QTime time, Qt::TimeSpec spec, int offsetSeconds) Line 3523	C++
       	Qt6Cored.dll!QDateTimeParser::scanString(const QDateTime & defaultValue, bool fixup) Line 1190	C++
       	Qt6Cored.dll!QDateTimeParser::parse(const QString & input, int position, const QDateTime & defaultValue, bool fixup) Line 1435	C++
       	Qt6Cored.dll!QDateTimeParser::fromString(const QString & t, QDateTime * datetime) Line 2165	C++
       	Qt6Cored.dll!QDateTime::fromString(const QString & string, QStringView format, QCalendar cal) Line 5130	C++
       	Qt6Cored.dll!QDateTime::fromString(const QString & string, const QString & format, 
       	qschannelbackendd.dll!QAsn1Element::toDateTime() Line 272	C++
       	qschannelbackendd.dll!QTlsPrivate::X509CertificateGeneric::parse(const QByteArray & data) Line 243	C++
       	qschannelbackendd.dll!QTlsPrivate::X509CertificateGeneric::certificatesFromDer(const QByteArray & der, int count) Line 169	C++
       	Qt6Networkd.dll!QSslCertificate::QSslCertificate(const QByteArray & data, QSsl::EncodingFormat format) Line 222	C++
       	qschannelbackendd.dll!QTlsPrivate::X509CertificateSchannel::QSslCertificate_from_CERT_CONTEXT(const _CERT_CONTEXT * certificateContext) Line 79	C++
       	qschannelbackendd.dll!QTlsPrivate::TlsCryptographSchannel::verifyCertContext::__l2::<lambda>(_CERT_CHAIN_ELEMENT * element) Line 2082	C++
       	qschannelbackendd.dll!QTlsPrivate::TlsCryptographSchannel::verifyCertContext(_CERT_CONTEXT * certContext) Line 2129	C++
       	qschannelbackendd.dll!QTlsPrivate::TlsCryptographSchannel::verifyHandshake() Line 1364	C++
       	qschannelbackendd.dll!QTlsPrivate::TlsCryptographSchannel::continueHandshake() Line 1871	C++
       	qschannelbackendd.dll!QTlsPrivate::TlsCryptographSchannel::transmit() Line 1507	C++
       	Qt6Networkd.dll!QSslSocketPrivate::transmit() Line 2903	C++
       	Qt6Networkd.dll!QSslSocketPrivate::_q_readyReadSlot() Line 2586	C++
       	Qt6Networkd.dll!QSslSocket::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 203	C++
       	Qt6Cored.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 3919	C++
       	Qt6Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3965	C++
       	Qt6Cored.dll!QIODevice::readyRead() Line 196	C++
       	Qt6Networkd.dll!QAbstractSocketPrivate::emitReadyRead(int channel) Line 1263	C++
       	Qt6Networkd.dll!QAbstractSocketPrivate::canReadNotification() Line 704	C++
       	Qt6Networkd.dll!QAbstractSocketPrivate::readNotification() Line 75	C++
       	Qt6Networkd.dll!QAbstractSocketEngine::readNotification() Line 157	C++
       	Qt6Networkd.dll!QReadNotifier::event(QEvent * e) Line 1275	C++
       	Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3401	C++
       	Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2760	C++
       	Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1063	C++
       	Qt6Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 1472	C++
       	Qt6Cored.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Line 193	C++
       	[External Code]	
       	Qt6Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 543	C++
       	Qt6Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 140	C++
       	Qt6Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 232	C++
       	Qt6Cored.dll!QThread::exec() Line 544	C++
       	Qt6Cored.dll!QThread::run() Line 614	C++
       	Qt6Cored.dll!QThreadPrivate::start(void * arg) Line 334	C++
       	[External Code]	
      

      There is strange conversion in qtbase\src\corelib\time\qtimezoneprivate_icu.cpp

      // Qt wrapper around ucal_getDSTSavings()
      static int ucalDaylightOffset(const QByteArray &id)
      {
          UErrorCode status = U_ZERO_ERROR;
          const int32_t dstMSecs = ucal_getDSTSavings(reinterpret_cast<const UChar *>(id.data()), &status);
          if (U_SUCCESS(status))
              return (dstMSecs / 1000);
          else
              return 0;
      }
      

      In my case id - Latin1 string (1 byte) "Europe/Minsk"
      and it's converted into UChar (uint16_t - 2 bytes) just using reinterpret_cast.
      I believe this is an actual issue that caused the crash.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Eddy Edward Welbourne
            studiosus Vladimir Belyavsky
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes