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

Possible overflow when using (const_)iterators with Qt containers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 4.8.5, 5.0.1
    • Fix Version/s: 5.0.0
    • Labels:
      None
    • Environment:
      win 7 x64/ Visual Studio 2010
    • Commits:
      b2f2967411bcb23a807f6a17b042b4c58701af95

      Description

      When using iterator classes on x64 platforms, the folowing warning is issued by the compiler:

      qt-4.8.5\include\qtcore\qlist.h(262) : warning C4244: 'return' : conversion from '__int64' to 'int', possible loss of data

      At this location is defined the operator-(iterator) which returns the difference between 2 pointers as an int.

      You typedef a difference_type in iterator class definition, which is basically equal to the size of a pointer. Returning this instead of an int should be enough to fix the problem.

      Note that all containers seem to be affected.

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            haniboul Manuel Garnier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes