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

Undefined behavior in moc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.9
    • Build tools: moc
    • None
    • Ubuntu 22.04 LTS
      clang 14.0.0

    Description

      Build Qt with clang and "-sanitize undefined". While building, the sanitizer will report something like:

      /home/qtrob/dev/src/qt-dev_06.20-base_imageformats_svg/qtbase/src/corelib/text/qstring.cpp:508:16: runtime error: applying non-zero offset 16 to null pointer
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qtrob/dev/src/qt-dev_06.20-base_imageformats_svg/qtbase/src/corelib/text/qstring.cpp:508:16 in 
      /home/qtrob/dev/src/qt-dev_06.20-base_imageformats_svg/qtbase/src/corelib/text/qstring.cpp:519:13: runtime error: applying non-zero offset 8 to null pointer
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qtrob/dev/src/qt-dev_06.20-base_imageformats_svg/qtbase/src/corelib/text/qstring.cpp:519:13 in
      

      To get a proper backtrace, I used an additional assert:

      1  __pthread_kill_implementation                                                              pthread_kill.c 44   0x7e38baa969fc 
      2  __pthread_kill_internal                                                                    pthread_kill.c 78   0x7e38baa969fc 
      3  __GI___pthread_kill                                                                        pthread_kill.c 89   0x7e38baa969fc 
      4  __GI_raise                                                                                 raise.c        26   0x7e38baa42476 
      5  __GI_abort                                                                                 abort.c        79   0x7e38baa287f3 
      6  qAbort                                                                                     qassert.cpp    49   0x55c599cd3f7d 
      7  qt_message_fatal<QString&>                                                                 qlogging.cpp   2112 0x55c599cd5178 
      8  qt_message                                                                                 qlogging.cpp   380  0x55c599cd41f4 
      9  QMessageLogger::fatal                                                                      qlogging.cpp   880  0x55c599cd46b6 
      10 qt_assert                                                                                  qassert.cpp    105  0x55c599cd3fce 
      11 simdTestMask                                                                               qstring.cpp    435  0x55c599d2e6ea 
      12 isAscii_helper                                                                             qstring.cpp    867  0x55c599d2e5e2 
      13 QtPrivate::isAscii                                                                         qstring.cpp    886  0x55c599d2e53c 
      14 QCborContainerPrivate::append                                                              qcborvalue_p.h 247  0x55c599d82f8a 
      15 QCborValue::QCborValue                                                                     qcborvalue.cpp 1954 0x55c599d82f06 
      16 QCborValue::QCborValue                                                                     qcborvalue.cpp 1943 0x55c599d82e7e 
      17 QJsonValue::QJsonValue                                                                     qjsonvalue.cpp 188  0x55c599d10511 
      18 FunctionDef::toJson                                                                        moc.cpp        2091 0x55c599c972fa 
      19 ClassDef::toJson() const::$_6::operator()(QString const&, QList<FunctionDef> const&) const moc.cpp        2022 0x55c599c95fce 
      20 ClassDef::toJson                                                                           moc.cpp        2030 0x55c599c91f47 
      21 Moc::generate                                                                              moc.cpp        1224 0x55c599c90bfb 
      22 runMoc                                                                                     main.cpp       578  0x55c599c6bbed 
      23 main                                                                                       main.cpp       652  0x55c599c6ecc6 
      

      Attachments

        For Gerrit Dashboard: QTBUG-126555
        # Subject Branch Project Status CR V

        Activity

          People

            fabiankosmale Fabian Kosmale
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change