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

[REG 6.3.2 -> 6.4.0] toString() on valid QDateTime causes undefined behavior

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.6.0
    • 6.4.0, 6.6
    • Core: Date/Time
    • Ubuntu 20.04 LTS
      clang 10.0.0
    • 5
    • 19c913b43 (dev)
    • Foundation Sprint 74

    Description

      1. Have a build of Qt configured with "-sanitize undefined".
      2. Use that to build the attached project.
        The output will include something like:
        /home/qtrob/dev/src/qt-dev_01.02-base_imageformats_svg/qtbase/src/corelib/time/qdatetime.cpp:3061:60: runtime error: signed integer overflow: -106751991168 * 86400000 cannot be represented in type 'long long'
        SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qtrob/dev/src/qt-dev_01.02-base_imageformats_svg/qtbase/src/corelib/time/qdatetime.cpp:3061:60 in 
        /home/qtrob/dev/src/qt-dev_01.02-base_imageformats_svg/qtbase/src/corelib/time/qdatetime.cpp:3061:53: runtime error: signed integer overflow: -9223372036838297000 - 9223372036794351616 cannot be represented in type 'long long'
        SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/qtrob/dev/src/qt-dev_01.02-base_imageformats_svg/qtbase/src/corelib/time/qdatetime.cpp:3061:53 in
        

      I expect that a valid QDateTime can be converted to a QString without undefined behavior.

      Google's oss-fuzz found this as issue 47607.

      Attachments

        1. 47607.cbor
          0.0 kB
        2. CMakeLists.txt
          0.5 kB
        3. main.cpp
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Eddy Edward Welbourne
            rlohning Robert Löhning
            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