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

reference binding to misaligned address

    XMLWordPrintable

Details

    • d53fdc516b62cf9e5977f0ab597432033ef790ae (qt/qtdeclarative/dev)

    Description

      I used Qt 5.15 (git branch) compiled with "./configure -sanitize address -sanitize undefined" (with gcc/linux/amd64),
      when I run "hello world" QML I got:

      /home/evgeniy/bigdisk1/projects/cpp-infra/qt5/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:204:32: runtime error: reference binding to misaligned address 0x6170000007bc for type 'struct Object *', which requires 8 byte alignment
      0x6170000007bc: note: pointer points here
        40 60 00 00 08 b0 68 fa  73 7f 00 00 00 b0 68 fa  73 7f 00 00 00 04 09 fa  73 7f 00 00 80 0b 09 fa
                    ^
      ../../include/QtQml/5.15.0/QtQml/private/../../../../../../../qtdeclarative/src/qml/jsruntime/qv4value_p.h:324:33: runtime error: load of misaligned address 0x6170000007bc for type 'struct Object *', which requires 8 byte alignment
      0x6170000007bc: note: pointer points here
        40 60 00 00 08 b0 68 fa  73 7f 00 00 00 b0 68 fa  73 7f 00 00 00 04 09 fa  73 7f 00 00 80 0b 09 fa
                    ^
      

      As I understand here we got access to not aligned to 8 bytes pointer:

          QV4::ExecutionEngine *v4 = m_context->engine->handle();
          callData->thisObject = v4->globalObject;
      

      In general it should handled by compiler just fine, because of
      EngineBase is packed,
      but `operator=` is overloaded via:

      template<typename Managed>
      inline StaticValue &StaticValue::operator=(const Managed &m)
      {
          *static_cast<Value *>(this) = m;
          return *this;
      }
      

      and this code already thinks that `m` is properly aligned,
      so it may be undefined behaviour.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            evgeniy_dushistov evgeniy_dushistov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes