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

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

XMLWordPrintable

      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.

        1. main.qml
          0.7 kB
          Igor Null
        2. main-shorter.qml
          0.4 kB
          Igor Null
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes