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

QStandardItem throws bad_alloc with large int in constructor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.4.1
    • Widgets: Itemviews
    • None
    • Archlinux, also could reproduce on Debian Jessie with Qt 5.3.2.

      When using QStandardItem with the QStandardItem::QStandardItem(int rows, int columns = 1) constructor, and passing 268435453 or bigger as int, I get this in Qt Designer:

      terminate called after throwing an instance of 'std::bad_alloc'
        what():  std::bad_alloc
      

      gdb backtrace (from a different system):

      #0  0x00007ffff7406c2d in __memset_sse2 () from /usr/lib/libc.so.6
      #1  0x00007fffeccc522d in defaultConstruct (this=0x555558391490, to=<optimized out>, from=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qvector.h:284
      #2  QVector<QStandardItem*>::reallocData (this=0x555558391490, asize=1426111944, aalloc=<optimized out>, options=...) at ../../include/QtCore/../../src/corelib/tools/qvector.h:529
      #3  0x00007fffeccc52a5 in QVector<QStandardItem*>::resize (this=this@entry=0x555558391490, asize=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qvector.h:381
      #4  0x00007fffeccbdc18 in QStandardItemPrivate::insertColumns (this=this@entry=0x555558391470, column=column@entry=0, count=count@entry=1, items=...) at itemmodels/qstandarditemmodel.cpp:450
      #5  0x00007fffeccbde81 in QStandardItem::insertColumns (this=0x5555583913e0, column=0, count=1) at itemmodels/qstandarditemmodel.cpp:1521
      

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

            thiago Thiago Macieira
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes