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

Application crashes with segfault if Array#sort arguments are re-used as variables

    XMLWordPrintable

Details

    Description

      Summary:
      JavaScript interpreter crashes if Array#sort arguments are re-used as variables.
      e.g.

      arr.sort(function(a, b) {
          a = transform(a);
          b = transform(b);
          return a == b ? 0 : a > b ? 1 : -1;
      });
      

      Expected result:
      Array is sorted successfully

      Actual result:
      Qt application crashes with SEGFAULT and message:
      file:///.../main.qml:23: TypeError: Cannot read property 'val' of null

      Full code to reproduce this bug attached as main.qml.

      Attachments

        1. main.qml
          0.7 kB
        2. main-shorter.qml
          0.4 kB

        Issue Links

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

          Activity

            People

              laknoll Lars Knoll
              m1el Igor Null
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes