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

The QMutable*Event construct is Undefined Behaviour

    XMLWordPrintable

Details

    Description

      Says ubsan:

      1: /home/marc/Qt/qtbase-build/include/QtGui/6.3.0/QtGui/private/../../../../../../qtbase/src/gui/kernel/qevent_p.h:73:62: runtime error: downcast of address 0x7fffca0e7fc0 which does not point to an object of type 'QMutableTouchEvent'
      1: 0x7fffca0e7fc0: note: object is of type 'QTouchEvent'
      1:  00 00 00 00  a0 0a 01 b8 61 7f 00 00  c2 00 00 00 01 00 00 60  f0 c5 00 00 20 60 00 00  00 00 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QTouchEvent'
      1: /home/marc/Qt/qtbase/src/widgets/kernel/qapplication.cpp:3127:38: runtime error: member call on address 0x7fffca0e7fc0 which does not point to an object of type 'QMutableTouchEvent'
      1: 0x7fffca0e7fc0: note: object is of type 'QTouchEvent'
      1:  00 00 00 00  a0 0a 01 b8 61 7f 00 00  c2 00 00 00 01 00 00 60  f0 c5 00 00 20 60 00 00  00 00 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QTouchEvent'
      1: /home/marc/Qt/qtbase-build/include/QtGui/6.3.0/QtGui/private/../../../../../../qtbase/src/gui/kernel/qevent_p.h:73:62: runtime error: downcast of address 0x7fffca0e8030 which does not point to an object of type 'QMutableTouchEvent'
      1: 0x7fffca0e8030: note: object is of type 'QTouchEvent'
      1:  ff 7f 00 00  a0 0a 01 b8 61 7f 00 00  c2 00 00 00 01 00 00 60  f0 c5 00 00 20 60 00 00  00 00 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QTouchEvent'
      1: /home/marc/Qt/qtbase/src/widgets/graphicsview/qgraphicsview.cpp:2924:60: runtime error: member call on address 0x7fffca0e8030 which does not point to an object of type 'QMutableTouchEvent'
      1: 0x7fffca0e8030: note: object is of type 'QTouchEvent'
      1:  ff 7f 00 00  a0 0a 01 b8 61 7f 00 00  c2 00 00 00 01 00 00 60  f0 c5 00 00 20 60 00 00  00 00 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QTouchEvent'
      1: /home/marc/Qt/qtbase/src/widgets/kernel/qapplication.cpp:3153:38: runtime error: member call on address 0x7fffca0e8030 which does not point to an object of type 'QMutableTouchEvent'
      1: 0x7fffca0e8030: note: object is of type 'QTouchEvent'
      1:  ff 7f 00 00  a0 0a 01 b8 61 7f 00 00  c2 00 00 00 00 00 00 60  f0 c5 00 00 20 60 00 00  00 00 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QTouchEvent'
      

      as well as

      1: /home/marc/Qt/qtbase/src/widgets/kernel/qapplication.cpp:2816:66: runtime error: member call on address 0x7fffca0e05a0 which does not point to an object of type 'QMutableSinglePointEvent'
      1: 0x7fffca0e05a0: note: object is of type 'QMouseEvent'
      1:  00 00 00 00  20 04 01 b8 61 7f 00 00  05 00 00 01 01 00 00 e0  30 c6 00 00 20 60 00 00  72 02 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QMouseEvent'
      1: /home/marc/Qt/qtbase-build/include/QtGui/6.3.0/QtGui/private/../../../../../../qtbase/src/gui/kernel/qevent_p.h:92:74: runtime error: downcast of address 0x7fffca0e2720 which does not point to an object of type 'QMutableSinglePointEvent'
      1: 0x7fffca0e2720: note: object is of type 'QMouseEvent'
      1:  61 7f 00 00  20 04 01 b8 61 7f 00 00  05 00 00 01 01 00 00 e0  30 c6 00 00 20 60 00 00  72 02 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QMouseEvent'
      1: /home/marc/Qt/qtbase/src/widgets/kernel/qapplication.cpp:2816:119: runtime error: member call on address 0x7fffca0e2720 which does not point to an object of type 'QMutableSinglePointEvent'
      1: 0x7fffca0e2720: note: object is of type 'QMouseEvent'
      1:  61 7f 00 00  20 04 01 b8 61 7f 00 00  05 00 00 01 01 00 00 e0  30 c6 00 00 20 60 00 00  72 02 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QMouseEvent'
      1: /home/marc/Qt/qtbase-build/include/QtGui/6.3.0/QtGui/private/../../../../../../qtbase/src/gui/kernel/qevent_p.h:92:74: runtime error: downcast of address 0x7fffca0e4e80 which does not point to an object of type 'QMutableSinglePointEvent'
      1: 0x7fffca0e4e80: note: object is of type 'QMouseEvent'
      1:  61 7f 00 00  20 04 01 b8 61 7f 00 00  02 00 00 01 01 00 00 e0  f0 c5 00 00 20 60 00 00  72 02 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QMouseEvent'
      1: /home/marc/Qt/qtbase/src/widgets/kernel/qwidgetwindow.cpp:659:109: runtime error: member call on address 0x7fffca0e4e80 which does not point to an object of type 'QMutableSinglePointEvent'
      1: 0x7fffca0e4e80: note: object is of type 'QMouseEvent'
      1:  61 7f 00 00  20 04 01 b8 61 7f 00 00  02 00 00 01 01 00 00 e0  f0 c5 00 00 20 60 00 00  72 02 00 00
      1:               ^~~~~~~~~~~~~~~~~~~~~~~
      1:               vptr for 'QMouseEvent'
      

      (all while executing tst_qtouchevent).

      We need a different mechanism that doesn't rely on casting to a non-existing subclass. E.g. a friend class that holds a pointer to the event and that can reach into it to make changes.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              mmutz Marc Mutz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change