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

Integer overflow in QString::replace( int position, int n, const QString & after )

    XMLWordPrintable

Details

    • 403b15488b3d687bc2830099f075a5ad12f0ef5f

    Description

      In 2009, commit 8135af2cebdaaccefb95f0be149328077d237a89 corrected an integer overflow bug in QString::remove(int, int). Unfortunately, the same bug exists in QString::replace(), but was not previously detected.

      The bug can be easily demonstrated by passing INT_MAX as the second parameter. Suitable test data and a QEXPECT_FAIL have been added to the tst_QString::replace_uint_uint() test function in the QString autotest.

      When correcting this bug, don't forget to check whether the same bug exists in other QString::replace() overloads.

      It would also be worthwhile to add a note to the function documentation to state what happens when the value of the second parameter is greater than the remaining length of the string. A similar note is already present for QString::remove(int, int).

      Attachments

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

        Activity

          People

            stromme Christian
            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes