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

QString::mid function has integer overflow issue when handling INT_MIN boundary conditions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.12
    • Core: I/O
    • Linux/X11

      In the QContainerImplHelper::mid function (qtbase/src/corelib/tools/qarraydata.h:189), there is an integer overflow issue when processing INT_MIN as the position parameter.Specific Issue:When position = INT_MIN and length = INT_MAX, the calculation of length + position causes integer overflow:

      • On 32-bit systems: INT_MIN = -2147483648, INT_MAX = 2147483647
      • length + position = 2147483647 + (-2147483648) = -1

      This leads to unexpected behavior and may return incorrect results.

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

            thiago Thiago Macieira
            caimengci_uniontech mengci cai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes