Fwd: New Defects reported by Coverity Scan for Konsole

kurt.hindenburg at gmail.com kurt.hindenburg at gmail.com
Thu Jul 18 16:20:30 BST 2019


Hi, it has been a few years since I submitted Konsole to coverity but w/ 
all the recent changes I uploaded a build based on the master branch.

Kurt

-------- Forwarded Message --------
Subject: 	New Defects reported by Coverity Scan for Konsole
Date: 	Thu, 18 Jul 2019 15:14:32 +0000 (UTC)
From: 	scan-admin at coverity.com
To: 	kurt.hindenburg at gmail.com



Hi,

Please find the latest report on new defect(s) introduced to Konsole 
found with Coverity Scan.

7 new defect(s) introduced to Konsole found with Coverity Scan.
14 defect(s), reported by Coverity Scan earlier, were marked fixed in 
the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 7 of 7 defect(s)


** CID 241679: (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
143 in Konsole::KeyboardTranslatorTest::testHexKeys()()
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
148 in Konsole::KeyboardTranslatorTest::testHexKeys()()
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
147 in Konsole::KeyboardTranslatorTest::testHexKeys()()
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
144 in Konsole::KeyboardTranslatorTest::testHexKeys()()


________________________________________________________________________________________________________
*** CID 241679: (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
143 in Konsole::KeyboardTranslatorTest::testHexKeys()()
137 138 // A worthless check ATM
139 if (reader.parseError()) {
140 QFAIL("Parse failure");
141 }
142
>>> CID 241679: (RESOURCE_LEAK)
>>> Variable "translator" going out of scope leaks the storage it points to.
143 QCOMPARE(QStringLiteral("testtranslator"), translator->name());
144 QCOMPARE(QString(), translator->description());
145 146 auto entry = translator->findEntry(Qt::Key_Backspace, nullptr);
147 QVERIFY(!entry.isNull());
148 QCOMPARE(FallbackKeyboardTranslator::Command::NoCommand, 
entry.command());
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
148 in Konsole::KeyboardTranslatorTest::testHexKeys()()
142 143 QCOMPARE(QStringLiteral("testtranslator"), translator->name());
144 QCOMPARE(QString(), translator->description());
145 146 auto entry = translator->findEntry(Qt::Key_Backspace, nullptr);
147 QVERIFY(!entry.isNull());
>>> CID 241679: (RESOURCE_LEAK)
>>> Variable "translator" going out of scope leaks the storage it points to.
148 QCOMPARE(FallbackKeyboardTranslator::Command::NoCommand, 
entry.command());
149 QCOMPARE(int(Qt::Key_Backspace), entry.keyCode());
150 QCOMPARE(QByteArray("\x7F"), entry.text());
151 QCOMPARE(QByteArray("\\x7f"), entry.escapedText());
152 QCOMPARE(Qt::KeyboardModifiers(Qt::NoModifier), entry.modifiers());
153 QCOMPARE(Qt::KeyboardModifiers(Qt::NoModifier), entry.modifierMask());
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
147 in Konsole::KeyboardTranslatorTest::testHexKeys()()
141 }
142 143 QCOMPARE(QStringLiteral("testtranslator"), translator->name());
144 QCOMPARE(QString(), translator->description());
145 146 auto entry = translator->findEntry(Qt::Key_Backspace, nullptr);
>>> CID 241679: (RESOURCE_LEAK)
>>> Variable "translator" going out of scope leaks the storage it points to.
147 QVERIFY(!entry.isNull());
148 QCOMPARE(FallbackKeyboardTranslator::Command::NoCommand, 
entry.command());
149 QCOMPARE(int(Qt::Key_Backspace), entry.keyCode());
150 QCOMPARE(QByteArray("\x7F"), entry.text());
151 QCOMPARE(QByteArray("\\x7f"), entry.escapedText());
152 QCOMPARE(Qt::KeyboardModifiers(Qt::NoModifier), entry.modifiers());
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
144 in Konsole::KeyboardTranslatorTest::testHexKeys()()
138 // A worthless check ATM
139 if (reader.parseError()) {
140 QFAIL("Parse failure");
141 }
142 143 QCOMPARE(QStringLiteral("testtranslator"), translator->name());
>>> CID 241679: (RESOURCE_LEAK)
>>> Variable "translator" going out of scope leaks the storage it points to.
144 QCOMPARE(QString(), translator->description());
145 146 auto entry = translator->findEntry(Qt::Key_Backspace, nullptr);
147 QVERIFY(!entry.isNull());
148 QCOMPARE(FallbackKeyboardTranslator::Command::NoCommand, 
entry.command());
149 QCOMPARE(int(Qt::Key_Backspace), entry.keyCode());

** CID 241678: Resource leaks (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/KeyBindingEditor.cpp: 309 in 
Konsole::KeyBindingEditor::accept()()


________________________________________________________________________________________________________
*** CID 241678: Resource leaks (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/KeyBindingEditor.cpp: 309 in 
Konsole::KeyBindingEditor::accept()()
303 }
304 305 const auto newTranslator = new KeyboardTranslator(*_translator);
306 307 if (newTranslator->description().isEmpty()) {
308 KMessageBox::sorry(this, i18n("A key bindings scheme cannot be saved 
with an empty description."));
>>> CID 241678: Resource leaks (RESOURCE_LEAK)
>>> Variable "newTranslator" going out of scope leaks the storage it 
>>> points to.
309 return;
310 }
311 312 if (_isNewTranslator) {
313 newTranslator->setName(newTranslator->description());
314 }

** CID 241677: Low impact quality (MISSING_MOVE_ASSIGNMENT)
/zpool/projects/Devel/KDE/src/konsole/tools/uni2characterwidth/template.h: 
30 in ()


________________________________________________________________________________________________________
*** CID 241677: Low impact quality (MISSING_MOVE_ASSIGNMENT)
/zpool/projects/Devel/KDE/src/konsole/tools/uni2characterwidth/template.h: 
30 in ()
24 25 #include <QMap>
26 #include <QString>
27 #include <QVector>
28 29 // QVariant doesn't offer modification in place. Var does.
>>> CID 241677: Low impact quality (MISSING_MOVE_ASSIGNMENT)
>>> Class "Var" may benefit from adding a move assignment operator. See 
>>> other events which show the copy assignment operator being applied 
>>> to rvalue(s), where a move assignment may be faster.
30 class Var {
31 public:
32 using Number = qint64;
33 using String = QString;
34 using Map = QMap<String, Var>;
35 using Vector = QVector<Var>;

** CID 241676: Resource leaks (RESOURCE_LEAK)
/src/autotests/TerminalCharacterDecoderTest_autogen/EWIEGA46WW/moc_TerminalCharacterDecoderTest.cpp: 
93 in Konsole::TerminalCharacterDecoderTest::qt_static_metacall(QObject 
*, QMetaObject::Call, int, void **)()


________________________________________________________________________________________________________
*** CID 241676: Resource leaks (RESOURCE_LEAK)
/src/autotests/TerminalCharacterDecoderTest_autogen/EWIEGA46WW/moc_TerminalCharacterDecoderTest.cpp: 
93 in Konsole::TerminalCharacterDecoderTest::qt_static_metacall(QObject 
*, QMetaObject::Call, int, void **)()
87 {
88 if (_c == QMetaObject::InvokeMetaMethod) {
89 auto *_t = static_cast<TerminalCharacterDecoderTest *>(_o);
90 Q_UNUSED(_t)
91 switch (_id) {
92 case 0: { Character* _r = _t->convertToCharacter((*reinterpret_cast< 
const QString(*)>(_a[1])),(*reinterpret_cast< 
QVector<RenditionFlags>(*)>(_a[2])));
>>> CID 241676: Resource leaks (RESOURCE_LEAK)
>>> Variable "_r" going out of scope leaks the storage it points to.
93 if (_a[0]) *reinterpret_cast< Character**>(_a[0]) = std::move(_r); } 
break;
94 case 1: _t->testPlainTextDecoder(); break;
95 case 2: _t->testPlainTextDecoder_data(); break;
96 case 3: _t->testHTMLDecoder(); break;
97 case 4: _t->testHTMLDecoder_data(); break;
98 default: ;

** CID 241675: (UNINTENDED_INTEGER_DIVISION)
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 728 in 
Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &, const 
QColor &, const QColor &, bool &)()
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 729 in 
Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &, const 
QColor &, const QColor &, bool &)()


________________________________________________________________________________________________________
*** CID 241675: (UNINTENDED_INTEGER_DIVISION)
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 728 in 
Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &, const 
QColor &, const QColor &, bool &)()
722 painter.setPen(cursorColor);
723 724 if (_cursorShape == Enum::BlockCursor) {
725 // draw the cursor outline, adjusting the area so that
726 // it is draw entirely inside 'rect'
727 int penWidth = qMax(1, painter.pen().width());
>>> CID 241675: (UNINTENDED_INTEGER_DIVISION)
>>> Dividing integer expressions "penWidth" and "2", and then converting 
>>> the integer quotient to type "double". Any remainder, or fractional 
>>> part of the quotient, is ignored.
728 painter.drawRect(cursorRect.adjusted(penWidth / 2 + 0.5,
729 penWidth / 2 + 0.5,
730 - penWidth / 2 - penWidth % 2 + 0.5,
731 - penWidth / 2 - penWidth % 2 + 0.5));
732 733 // draw the cursor body only when the widget has focus
/zpool/projects/Devel/KDE/src/konsole/src/TerminalDisplay.cpp: 729 in 
Konsole::TerminalDisplay::drawCursor(QPainter &, const QRect &, const 
QColor &, const QColor &, bool &)()
723 724 if (_cursorShape == Enum::BlockCursor) {
725 // draw the cursor outline, adjusting the area so that
726 // it is draw entirely inside 'rect'
727 int penWidth = qMax(1, painter.pen().width());
728 painter.drawRect(cursorRect.adjusted(penWidth / 2 + 0.5,
>>> CID 241675: (UNINTENDED_INTEGER_DIVISION)
>>> Dividing integer expressions "penWidth" and "2", and then converting 
>>> the integer quotient to type "double". Any remainder, or fractional 
>>> part of the quotient, is ignored.
729 penWidth / 2 + 0.5,
730 - penWidth / 2 - penWidth % 2 + 0.5,
731 - penWidth / 2 - penWidth % 2 + 0.5));
732 733 // draw the cursor body only when the widget has focus
734 if (hasFocus()) {

** CID 241674: (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
104 in Konsole::KeyboardTranslatorTest::testFallback()()
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
105 in Konsole::KeyboardTranslatorTest::testFallback()()
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
108 in Konsole::KeyboardTranslatorTest::testFallback()()


________________________________________________________________________________________________________
*** CID 241674: (RESOURCE_LEAK)
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
104 in Konsole::KeyboardTranslatorTest::testFallback()()
98 99 // Use FallbackKeyboardTranslator to test basic functionality
100 void KeyboardTranslatorTest::testFallback()
101 {
102 auto fallback = new FallbackKeyboardTranslator();
103
>>> CID 241674: (RESOURCE_LEAK)
>>> Variable "fallback" going out of scope leaks the storage it points to.
104 QCOMPARE(QStringLiteral("fallback"), fallback->name());
105 QCOMPARE(QStringLiteral("Fallback Keyboard Translator"), 
fallback->description());
106 107 auto entries = fallback->entries();
108 QCOMPARE(1, entries.size());
109 auto entry = fallback->findEntry(Qt::Key_Tab, nullptr);
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
105 in Konsole::KeyboardTranslatorTest::testFallback()()
99 // Use FallbackKeyboardTranslator to test basic functionality
100 void KeyboardTranslatorTest::testFallback()
101 {
102 auto fallback = new FallbackKeyboardTranslator();
103 104 QCOMPARE(QStringLiteral("fallback"), fallback->name());
>>> CID 241674: (RESOURCE_LEAK)
>>> Variable "fallback" going out of scope leaks the storage it points to.
105 QCOMPARE(QStringLiteral("Fallback Keyboard Translator"), 
fallback->description());
106 107 auto entries = fallback->entries();
108 QCOMPARE(1, entries.size());
109 auto entry = fallback->findEntry(Qt::Key_Tab, nullptr);
110 QVERIFY(!entry.isNull());
/zpool/projects/Devel/KDE/src/konsole/src/autotests/KeyboardTranslatorTest.cpp: 
108 in Konsole::KeyboardTranslatorTest::testFallback()()
102 auto fallback = new FallbackKeyboardTranslator();
103 104 QCOMPARE(QStringLiteral("fallback"), fallback->name());
105 QCOMPARE(QStringLiteral("Fallback Keyboard Translator"), 
fallback->description());
106 107 auto entries = fallback->entries();
>>> CID 241674: (RESOURCE_LEAK)
>>> Variable "fallback" going out of scope leaks the storage it points to.
108 QCOMPARE(1, entries.size());
109 auto entry = fallback->findEntry(Qt::Key_Tab, nullptr);
110 QVERIFY(!entry.isNull());
111 QCOMPARE(FallbackKeyboardTranslator::Command::NoCommand, 
entry.command());
112 QCOMPARE(int(Qt::Key_Tab), entry.keyCode());
113 QCOMPARE(QByteArray("\t"), entry.text());

** CID 187355: Resource leaks (VIRTUAL_DTOR)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer_impl.h: 141 in ()


________________________________________________________________________________________________________
*** CID 187355: Resource leaks (VIRTUAL_DTOR)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer_impl.h: 141 in ()
135 // "weakref" is the outer reference counter and it tracks the 
lifetime of
136 // the ExternalRefCountData object.
137 //
138 // The deleter is stored in the destroyer member and is always a 
pointer to
139 // a static function in ExternalRefCountWithCustomDeleter or in
140 // ExternalRefCountWithContiguousData
>>> CID 187355: Resource leaks (VIRTUAL_DTOR)
>>> Class "QtSharedPointer::ExternalRefCountData" does not have a 
>>> virtual destructor.
141 struct ExternalRefCountData
142 {
143 typedef void (*DestroyerFn)(ExternalRefCountData *);
144 QBasicAtomicInt weakref;
145 QBasicAtomicInt strongref;
146 DestroyerFn destroyer;


_
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20190718/c2de92ee/attachment-0001.html>


More information about the konsole-devel mailing list