Fwd: New Defects reported by Coverity Scan for Konsole

Kurt Hindenburg kurt.hindenburg at gmail.com
Thu Dec 16 16:52:35 GMT 2021


From master 16th Dec.

Thanks,
   Kurt

> New defect(s) Reported-by: Coverity Scan
> Showing 9 of 9 defect(s)
> 
> 
> ** CID 345002:  Incorrect expression  (USELESS_CALL)
> 
> 
> ________________________________________________________________________________________________________
> *** CID 345002:  Incorrect expression  (USELESS_CALL)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/cov-int/src/konsoleprivate_autogen/DRAQINE3W2/moc_TerminalDisplay.cpp: 347 in Konsole::TerminalDisplay::qt_static_metacall(QObject *, QMetaObject::Call, int, void **)()
> 341             case 29: _t->outputSuspended((*reinterpret_cast< bool(*)>(_a[1]))); break;
> 342             case 30: _t->setUsesMouseTracking((*reinterpret_cast< bool(*)>(_a[1]))); break;
> 343             case 31: _t->setBracketedPasteMode((*reinterpret_cast< bool(*)>(_a[1]))); break;
> 344             case 32: _t->bell((*reinterpret_cast< const QString(*)>(_a[1]))); break;
> 345             case 33: _t->setMargin((*reinterpret_cast< int(*)>(_a[1]))); break;
> 346             case 34: _t->setCenterContents((*reinterpret_cast< bool(*)>(_a[1]))); break;
>>>>   CID 345002:  Incorrect expression  (USELESS_CALL)
>>>>   Calling "_t->colorScheme()" is only useful for its return value, which is ignored.
> 347             case 35: _t->colorScheme(); break;
> 348             case 36: { Qt::Edge _r = _t->droppedEdge();
> 349                 if (_a[0]) *reinterpret_cast< Qt::Edge*>(_a[0]) = std::move(_r); }  break;
> 350             case 37: _t->updateReadOnlyState((*reinterpret_cast< bool(*)>(_a[1]))); break;
> 351             case 38: { IncrementalSearchBar* _r = _t->searchBar();
> 352                 if (_a[0]) *reinterpret_cast< IncrementalSearchBar**>(_a[0]) = std::move(_r); }  break;
> 
> ** CID 345001:    (RESOURCE_LEAK)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 142 in Konsole::HistoryTest::testHistoryReflow()()
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 149 in Konsole::HistoryTest::testHistoryReflow()()
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 143 in Konsole::HistoryTest::testHistoryReflow()()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 345001:    (RESOURCE_LEAK)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 142 in Konsole::HistoryTest::testHistoryReflow()()
> 136         for (int i = 0; i < testStringSize; i++) {
> 137             testImage[i] = Character((uint)testString[i]);
> 138         }
> 139     
> 140         // None
> 141         historyScroll = new HistoryScrollNone();
>>>>   CID 345001:    (RESOURCE_LEAK)
>>>>   Variable "testImage" going out of scope leaks the storage it points to.
> 142         QCOMPARE(historyScroll->getMaxLines(), 0);
> 143         QCOMPARE(historyScroll->reflowLines(10), 0);
> 144     
> 145         delete historyScroll;
> 146     
> 147         // Compact
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 149 in Konsole::HistoryTest::testHistoryReflow()()
> 143         QCOMPARE(historyScroll->reflowLines(10), 0);
> 144     
> 145         delete historyScroll;
> 146     
> 147         // Compact
> 148         historyScroll = new CompactHistoryScroll(10);
>>>>   CID 345001:    (RESOURCE_LEAK)
>>>>   Variable "testImage" going out of scope leaks the storage it points to.
> 149         QCOMPARE(historyScroll->getMaxLines(), 10);
> 150         historyScroll->addCells(testImage, testStringSize);
> 151         historyScroll->addLine(false);
> 152         QCOMPARE(historyScroll->getLines(), 1);
> 153         QCOMPARE(historyScroll->reflowLines(10), 0);
> 154         QCOMPARE(historyScroll->getLines(), 4);
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/HistoryTest.cpp: 143 in Konsole::HistoryTest::testHistoryReflow()()
> 137             testImage[i] = Character((uint)testString[i]);
> 138         }
> 139     
> 140         // None
> 141         historyScroll = new HistoryScrollNone();
> 142         QCOMPARE(historyScroll->getMaxLines(), 0);
>>>>   CID 345001:    (RESOURCE_LEAK)
>>>>   Variable "testImage" going out of scope leaks the storage it points to.
> 143         QCOMPARE(historyScroll->reflowLines(10), 0);
> 144     
> 145         delete historyScroll;
> 146     
> 147         // Compact
> 148         historyScroll = new CompactHistoryScroll(10);
> 
> ** CID 345000:  Uninitialized members  (UNINIT_CTOR)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/TerminalInterfaceTest.h: 29 in Konsole::TerminalInterfaceTest::TerminalInterfaceTest()()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 345000:  Uninitialized members  (UNINIT_CTOR)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/autotests/TerminalInterfaceTest.h: 29 in Konsole::TerminalInterfaceTest::TerminalInterfaceTest()()
> 23         void testTerminalInterface();
> 24         void testTerminalInterfaceV2();
> 25     
> 26     private:
> 27         KParts::Part *createPart();
> 28     
>>>>   CID 345000:  Uninitialized members  (UNINIT_CTOR)
>>>>   The compiler-generated constructor for this class does not initialize "_terminalPart".
> 29         KParts::Part *_terminalPart;
> 30     };
> 31     
> 32     }
> 33     
> 
> ** CID 344999:  Uninitialized members  (UNINIT_CTOR)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/Screen.h: 758 in Konsole::Screen::SavedState::SavedState()()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 344999:  Uninitialized members  (UNINIT_CTOR)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/Screen.h: 758 in Konsole::Screen::SavedState::SavedState()()
> 752                 : cursorColumn(0)
> 753                 , cursorLine(0)
> 754                 , rendition(0)
> 755                 , foreground(CharacterColor())
> 756                 , background(CharacterColor())
> 757             {
>>>>   CID 344999:  Uninitialized members  (UNINIT_CTOR)
>>>>   Non-static class member "originMode" is not initialized in this constructor nor in any functions that it calls.
> 758             }
> 759     
> 760             int cursorColumn;
> 761             int cursorLine;
> 762             int originMode;
> 763             RenditionFlags rendition;
> 
> ** CID 344998:  Null pointer dereferences  (NULL_RETURNS)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/characters/Character.h: 193 in Konsole::Character::baseCodePoint() const()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 344998:  Null pointer dereferences  (NULL_RETURNS)
> /home/kurthindenburg/Devel/KDE/src/konsole/src/characters/Character.h: 193 in Konsole::Character::baseCodePoint() const()
> 187         inline uint baseCodePoint() const
> 188         {
> 189             if (rendition & RE_EXTENDED_CHAR) {
> 190                 ushort extendedCharLength = 0;
> 191                 const uint *chars = ExtendedCharTable::instance.lookupExtendedChar(character, extendedCharLength);
> 192                 // FIXME: Coverity-Dereferencing chars, which is known to be nullptr
>>>>   CID 344998:  Null pointer dereferences  (NULL_RETURNS)
>>>>   Dereferencing "chars", which is known to be "nullptr".
> 193                 return chars[0];
> 194             }
> 195             return character;
> 196         }
> 197     
> 198         inline bool isSameScript(Character lhs) const
> 
> ** CID 331055:  Uninitialized variables  (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 722 in QList<QString>::insert(int, const QString &)()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 331055:  Uninitialized variables  (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 722 in QList<QString>::insert(int, const QString &)()
> 716                 QT_TRY {
> 717                     n = reinterpret_cast<Node *>(p.insert(i));;
> 718                 } QT_CATCH(...) {
> 719                     node_destruct(&copy);
> 720                     QT_RETHROW;
> 721                 }
>>>>   CID 331055:  Uninitialized variables  (UNINIT)
>>>>   Using uninitialized value "copy". Field "copy.v" is uninitialized.
> 722                 *n = copy;
> 723             }
> 724         }
> 725     }
> 726     
> 727     template <typename T>
> 
> ** CID 323918:  Uninitialized members  (UNINIT_CTOR)
> /usr/include/x86_64-linux-gnu/qt5/QtTest/qtesteventloop.h: 85 in QTestEventLoop::QTestEventLoop()()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 323918:  Uninitialized members  (UNINIT_CTOR)
> /usr/include/x86_64-linux-gnu/qt5/QtTest/qtesteventloop.h: 85 in QTestEventLoop::QTestEventLoop()()
> 79         inline void exitLoop();
> 80     
> 81     protected:
> 82         inline void timerEvent(QTimerEvent *e) override;
> 83     
> 84     private:
>>>>   CID 323918:  Uninitialized members  (UNINIT_CTOR)
>>>>   The compiler-generated constructor for this class does not initialize "inLoop".
> 85         Q_DECL_UNUSED_MEMBER bool inLoop; // ### Qt 6: remove
> 86         bool _timeout = false;
> 87         int timerId = -1;
> 88     
> 89         QEventLoop *loop = nullptr;
> 90     };
> 
> ** CID 316540:    (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QExplicitlySharedDataPointer<Konsole::Profile>>::append(const QExplicitlySharedDataPointer<Konsole::Profile> &)()
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QString>::append(const QString &)()
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QByteArray>::append(const QByteArray &)()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 316540:    (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QExplicitlySharedDataPointer<Konsole::Profile>>::append(const QExplicitlySharedDataPointer<Konsole::Profile> &)()
> 642                 QT_TRY {
> 643                     n = reinterpret_cast<Node *>(p.append());;
> 644                 } QT_CATCH(...) {
> 645                     node_destruct(&copy);
> 646                     QT_RETHROW;
> 647                 }
>>>>   CID 316540:    (UNINIT)
>>>>   Using uninitialized value "copy". Field "copy.v" is uninitialized.
> 648                 *n = copy;
> 649             }
> 650         }
> 651     }
> 652     
> 653     template <typename T>
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QString>::append(const QString &)()
> 642                 QT_TRY {
> 643                     n = reinterpret_cast<Node *>(p.append());;
> 644                 } QT_CATCH(...) {
> 645                     node_destruct(&copy);
> 646                     QT_RETHROW;
> 647                 }
>>>>   CID 316540:    (UNINIT)
>>>>   Using uninitialized value "copy". Field "copy.v" is uninitialized.
> 648                 *n = copy;
> 649             }
> 650         }
> 651     }
> 652     
> 653     template <typename T>
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 648 in QList<QByteArray>::append(const QByteArray &)()
> 642                 QT_TRY {
> 643                     n = reinterpret_cast<Node *>(p.append());;
> 644                 } QT_CATCH(...) {
> 645                     node_destruct(&copy);
> 646                     QT_RETHROW;
> 647                 }
>>>>   CID 316540:    (UNINIT)
>>>>   Using uninitialized value "copy". Field "copy.v" is uninitialized.
> 648                 *n = copy;
> 649             }
> 650         }
> 651     }
> 652     
> 653     template <typename T>
> 
> ** CID 316518:  Uninitialized variables  (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 682 in QList<QString>::prepend(const QString &)()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 316518:  Uninitialized variables  (UNINIT)
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h: 682 in QList<QString>::prepend(const QString &)()
> 676                 QT_TRY {
> 677                     n = reinterpret_cast<Node *>(p.prepend());;
> 678                 } QT_CATCH(...) {
> 679                     node_destruct(&copy);
> 680                     QT_RETHROW;
> 681                 }
>>>>   CID 316518:  Uninitialized variables  (UNINIT)
>>>>   Using uninitialized value "copy". Field "copy.v" is uninitialized.
> 682                 *n = copy;
> 683             }
> 684         }
> 685     }
> 686     
> 687     template <typename T>
> 
> 


More information about the konsole-devel mailing list