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

QCollator silently fails on Windows

    XMLWordPrintable

Details

    • 7831b276e610368514087a81396d1ca2425b2e42 (qt/qtbase/5.12)

    Description

      QCollator on Windows uses CompareString(Ex). These methods return 0 on error (source). However, QCollator does not check for this return value (source: qcollator_win.cpp:97). Instead, if a flag is not supported, it returns a negative number for any comparison.

      Note that a comparator function with this behavior leads std::sort() to go out-of-bounds with iterators and crash the program.

      This can be observed when testing an application with WINE, which does not support SORT_DIGITSASNUMBERS flag. WINE correctly implements CompareStringEx according to Microsoft's documentation (source). For historical context, see also this commit.

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            ypnos Johannes Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes