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

REG: QHash reserve endless loop with size < currently used one

    XMLWordPrintable

Details

    • All
    • 5
    • d11941db41 (qt/qtbase/dev) cd7eb2f429 (qt/qtbase/6.3) c097807ebf (qt/qtbase/6.2) c097807ebf (qt/tqtc-qtbase/6.2) cd7eb2f429 (qt/tqtc-qtbase/6.3) d11941db41 (qt/tqtc-qtbase/dev)
    • Team A Foundation Sprint 55

    Description

      This code loops infinitely or crashs:

      QHash<int, int> test;
      for (int i = 0; i < 1000; ++i)
          test.insert(i, i);
      test.reserve(1);
      

      Found in my real life project

      https://invent.kde.org/frameworks/ktexteditor/-/commit/fc5dfb9f3545ee394dfd00e8bc92c9c1f9f536c5

      I assume the trivial fix would be to internally just use the max of the current size and the passed value.

      Attachments

        For Gerrit Dashboard: QTBUG-102067
        # Subject Branch Project Status CR V

        Activity

          People

            ivan.solovev Ivan Solovev
            cullmann Christoph Cullmann
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes