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

dom: fix memory errors when visiting QmlFile::m_astComments

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • 6.8
    • None
    • QML: Tooling
    • None

    Description

      It seems that the m_astComments member of Dom::QmlFile has some memory errors: segmentation faults, asan complains about stack-buffer-underflow but I could not really understand whats going wrong at the moment - probably a dangling reference somewhere.

      Reproducer: once you have created a DomItem of a qml file with comments, try to print it out via `qDebug() << item.field(Fields::astComments)` or visit it with a visitor. It will crash when trying to print out the comment.

       

      I used following qml file:

      // Copyright (C) 2023 The Qt Company Ltd.
      // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
      import QtQuick
      JSUsages {
          function f() {
              // sanity check: reuse variable names from function f in JSUsages. Those should not appear
              // as usages of the sum of JSUsages.
              let sum = 0;
              sum += 1;
              sum += helloProperty + 32 // valid usage of JSUsages's helloProperty
              return sum
          }}
      

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              sami.shalayel Sami Shalayel
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes