New Defects reported by Coverity Scan for krita
scan-admin at coverity.com
scan-admin at coverity.com
Mon Feb 20 20:43:24 GMT 2023
Hi,
Please find the latest report on new defect(s) introduced to krita found with Coverity Scan.
15 new defect(s) introduced to krita found with Coverity Scan.
332 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 15 of 15 defect(s)
** CID 436424: (NO_EFFECT)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 358 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 487 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
________________________________________________________________________________________________________
*** CID 436424: (NO_EFFECT)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 358 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
352 setProperty(FontVariationSettingsId, value.split(", "));
353 } else if (command == "text-decoration" || command == "text-decoration-line" || command == "text-decoration-style" || command == "text-decoration-color"
354 || command == "text-decoration-position") {
355 using namespace KoSvgText;
356
357 TextDecorations deco = propertyOrDefault(TextDecorationLineId).value<KoSvgText::TextDecorations>();
>>> CID 436424: (NO_EFFECT)
>>> Comparing an array to null is not useful: ""text-decoration-line"", since the test will always evaluate as true.
358 if (command == "text-decoration" || "text-decoration-line") {
359 // reset deco when those values are being set..
360 deco = KoSvgText::DecorationNone;
361 }
362
363 TextDecorationStyle style = TextDecorationStyle(propertyOrDefault(TextDecorationStyleId).toInt());
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 487 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
481 setProperty(InlineSizeId, KoSvgText::fromAutoValue(KoSvgText::parseAutoValueXY(value, context, "auto")));
482 } else if (command == "overflow") {
483 setProperty(TextOverFlowId, value == "visible" ? KoSvgText::OverFlowVisible : KoSvgText::OverFlowClip);
484 } else if (command == "text-overflow") {
485 setProperty(TextOverFlowId, value == "ellipse" ? KoSvgText::OverFlowEllipse : KoSvgText::OverFlowClip);
486 } else if (command == "overflow-wrap" || command == "word-wrap") {
>>> CID 436424: (NO_EFFECT)
>>> Comparing an array to null is not useful: ""anywhere"", since the test will always evaluate as true.
487 setProperty(OverflowWrapId,
488 value == "break-word" ? KoSvgText::OverflowWrapBreakWord
489 : "anywhere" ? KoSvgText::OverflowWrapAnywhere
490 : KoSvgText::OverflowWrapNormal);
491 } else if (command == "tab-size") {
492 setProperty(TabSizeId, QVariant::fromValue(KoSvgText::parseTabSize(value, context)));
** CID 436423: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 358 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
________________________________________________________________________________________________________
*** CID 436423: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 358 in KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &, const QString &, const QString &)()
352 setProperty(FontVariationSettingsId, value.split(", "));
353 } else if (command == "text-decoration" || command == "text-decoration-line" || command == "text-decoration-style" || command == "text-decoration-color"
354 || command == "text-decoration-position") {
355 using namespace KoSvgText;
356
357 TextDecorations deco = propertyOrDefault(TextDecorationLineId).value<KoSvgText::TextDecorations>();
>>> CID 436423: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> "command == "text-decoration" || true /* "text-decoration-line" */" is always true regardless of the values of its operands. This occurs as the logical operand of "if".
358 if (command == "text-decoration" || "text-decoration-line") {
359 // reset deco when those values are being set..
360 deco = KoSvgText::DecorationNone;
361 }
362
363 TextDecorationStyle style = TextDecorationStyle(propertyOrDefault(TextDecorationStyleId).toInt());
** CID 436422: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 436422: Null pointer dereferences (NULL_RETURNS)
/home/tymon/kritadev/krita/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp: 110 in KisAnimTimelineFramesModel::Private::frameHasContent(int, int)()
104 return (primaryChannel && primaryChannel->keyframeAt(column));
105 }
106
107 bool frameHasContent(int row, int column) {
108 KisNodeDummy *dummy = converter->dummyFromRow(row);
109
>>> CID 436422: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "nullptr" "dummy" when calling "node".
110 KisKeyframeChannel *primaryChannel = dummy->node()->getKeyframeChannel(KisKeyframeChannel::Raster.id());
111 if (!primaryChannel) return false;
112
113 // first check if we are a key frame
114 KisRasterKeyframeSP frame = primaryChannel->activeKeyframeAt<KisRasterKeyframe>(column);
115 if (!frame) return false;
** CID 436421: (DEADCODE)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 542 in KoSvgTextProperties::convertToSvgTextAttributes() const()
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 512 in KoSvgTextProperties::convertToSvgTextAttributes() const()
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 566 in KoSvgTextProperties::convertToSvgTextAttributes() const()
________________________________________________________________________________________________________
*** CID 436421: (DEADCODE)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 542 in KoSvgTextProperties::convertToSvgTextAttributes() const()
536
537 if (hasProperty(DominantBaselineId)) {
538 result.insert("dominant-baseline", writeDominantBaseline(Baseline(property(DominantBaselineId).toInt())));
539 }
540
541 if (svg1_1) {
>>> CID 436421: (DEADCODE)
>>> Execution cannot reach this statement: "if (this->hasProperty(KoSvg...".
542 if (hasProperty(AlignmentBaselineId)) {
543 result.insert("alignment-baseline", writeAlignmentBaseline(Baseline(property(AlignmentBaselineId).toInt())));
544 }
545
546 if (hasProperty(BaselineShiftModeId)) {
547 result.insert("baseline-shift",
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 512 in KoSvgTextProperties::convertToSvgTextAttributes() const()
506 if (hasProperty(WritingModeId)) {
507 result.insert("writing-mode", writeWritingMode(WritingMode(property(WritingModeId).toInt()), svg1_1));
508 }
509
510 if (hasProperty(TextOrientationId)) {
511 if (svg1_1) {
>>> CID 436421: (DEADCODE)
>>> Execution cannot reach this statement: "orientation = (KoSvgText::T...".
512 TextOrientation orientation = TextOrientation(property(TextOrientationId).toInt());
513 QString value = "auto";
514 if (orientation == OrientationUpright) {
515 value = "0";
516 } else if (orientation == OrientationSideWays) {
517 value = "90";
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextProperties.cpp: 566 in KoSvgTextProperties::convertToSvgTextAttributes() const()
560 result.insert("vertical-align", verticalAlign.join(" "));
561 }
562 }
563
564 if (hasProperty(KerningId)) {
565 if (svg1_1) {
>>> CID 436421: (DEADCODE)
>>> Execution cannot reach the expression "result.insert(QString const("kerning"), QString(KoSvgText::writeAutoValue(KoSvgText::AutoValue(QVariant(this->property(KoSvgTextProperties::KerningId, QVariant())).value()), QString const("auto"))))" inside this statement: "result.insert(QString const...".
566 result.insert("kerning", writeAutoValue(property(KerningId).value<AutoValue>()));
567 } else {
568 AutoValue kerning = property(KerningId).value<AutoValue>();
569 if (kerning.isAuto) {
570 result.insert("kerning", "auto");
571 } else if (kerning.customValue == 0) {
** CID 436420: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 436420: Null pointer dereferences (NULL_RETURNS)
/home/tymon/kritadev/krita/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp: 247 in KisAnimTimelineFramesModel::channelsAt(QModelIndex) const()
241 return dummy ? dummy->node() : 0;
242 }
243
244 QMap<QString, KisKeyframeChannel*> KisAnimTimelineFramesModel::channelsAt(QModelIndex index) const
245 {
246 KisNodeDummy *srcDummy = m_d->converter->dummyFromRow(index.row());
>>> CID 436420: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "nullptr" "srcDummy" when calling "node".
247 return srcDummy->node()->keyframeChannels();
248 }
249
250 KisKeyframeChannel *KisAnimTimelineFramesModel::channelByID(QModelIndex index, const QString &id) const
251 {
252 KisNodeDummy *srcDummy = m_d->converter->dummyFromRow(index.row());
** CID 436419: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/plugins/dockers/palettedocker/palettedocker_dock.cpp: 155 in PaletteDockerDock::~PaletteDockerDock()()
________________________________________________________________________________________________________
*** CID 436419: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/plugins/dockers/palettedocker/palettedocker_dock.cpp: 155 in PaletteDockerDock::~PaletteDockerDock()()
149
150
151 KoResourceServer<KoColorSet> *srv = KoResourceServerProvider::instance()->paletteServer();
152 srv->addObserver(this);
153 }
154
>>> CID 436419: Error handling issues (UNCAUGHT_EXCEPT)
>>> An exception of type "boost::wrapexcept<boost::bad_get>" is thrown but the exception specification "noexcept" doesn't allow it to be thrown. This will result in a call to terminate().
155 PaletteDockerDock::~PaletteDockerDock()
156 {
157 if (m_paletteEditor->isModified()) {
158 m_paletteEditor->saveNewPaletteVersion();
159 }
160 KoResourceServer<KoColorSet> *srv = KoResourceServerProvider::instance()->paletteServer();
** CID 436418: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 436418: Null pointer dereferences (FORWARD_NULL)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextChunkShape.cpp: 402 in KoSvgTextChunkShape::Private::LayoutInterface::collectSubChunks(bool, bool &) const()
396
397 } else {
398 Q_FOREACH (KoShape *shape, q->shapes()) {
399 KoSvgTextChunkShape *chunkShape = dynamic_cast<KoSvgTextChunkShape*>(shape);
400 KIS_SAFE_ASSERT_RECOVER_BREAK(chunkShape);
401
>>> CID 436418: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "chunkShape" to "layoutInterface", which dereferences it.
402 result += chunkShape->layoutInterface()->collectSubChunks(textInPath, firstTextInPath);
403 }
404 }
405
406 if (q->s->textPath) {
407 textInPath = false;
** CID 436417: Null pointer dereferences (FORWARD_NULL)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1943 in KoSvgTextShape::Private::computeTextDecorations(const KoShape *, const QVector<CharacterResult> &, const QMap<int, int> &, double, KoPathShape *, double, bool, int &, bool, bool, bool)()
________________________________________________________________________________________________________
*** CID 436417: Null pointer dereferences (FORWARD_NULL)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1943 in KoSvgTextShape::Private::computeTextDecorations(const KoShape *, const QVector<CharacterResult> &, const QMap<int, int> &, double, KoPathShape *, double, bool, int &, bool, bool, bool)()
1937 if (!wrapping) {
1938 currentTextPath = textPath ? textPath : dynamic_cast<KoPathShape *>(chunkShape->layoutInterface()->textPath());
1939
1940 if (chunkShape->layoutInterface()->textPath()) {
1941 textPathSide = chunkShape->layoutInterface()->textOnPathInfo().side == TextPathSideRight;
1942 if (chunkShape->layoutInterface()->textOnPathInfo().startOffsetIsPercentage) {
>>> CID 436417: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "currentTextPath" to "outline", which dereferences it. (The dereference happens because this is a virtual function call.)
1943 currentTextPathOffset = currentTextPath->outline().length() * (0.01 * chunkShape->layoutInterface()->textOnPathInfo().startOffset);
1944 } else {
1945 currentTextPathOffset = chunkShape->layoutInterface()->textOnPathInfo().startOffset;
1946 }
1947 }
1948 }
** CID 436416: (DIVIDE_BY_ZERO)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1605 in KoSvgTextShape::Private::applyTextLength(const KoShape *, QVector<CharacterResult> &, int &, int &, bool)()
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1605 in KoSvgTextShape::Private::applyTextLength(const KoShape *, QVector<CharacterResult> &, int &, int &, bool)()
________________________________________________________________________________________________________
*** CID 436416: (DIVIDE_BY_ZERO)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1605 in KoSvgTextShape::Private::applyTextLength(const KoShape *, QVector<CharacterResult> &, int &, int &, bool)()
1599 bool spacingAndGlyphs = (chunkShape->layoutInterface()->lengthAdjust() == KoSvgText::LengthAdjustSpacingAndGlyphs);
1600 if (!spacingAndGlyphs) {
1601 n -= 1;
1602 }
1603 const qreal delta = chunkShape->layoutInterface()->textLength().customValue - (b - a);
1604
>>> CID 436416: (DIVIDE_BY_ZERO)
>>> In expression "delta / n", division by expression "n" which may be zero has undefined behavior.
1605 const QPointF d = isHorizontal ? QPointF(delta / n, 0) : QPointF(0, delta / n);
1606
1607 QPointF shift;
1608 bool secondTextLengthApplied = false;
1609 Q_FOREACH (int k, visualToLogical.keys()) {
1610 CharacterResult cr = result[visualToLogical.value(k)];
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 1605 in KoSvgTextShape::Private::applyTextLength(const KoShape *, QVector<CharacterResult> &, int &, int &, bool)()
1599 bool spacingAndGlyphs = (chunkShape->layoutInterface()->lengthAdjust() == KoSvgText::LengthAdjustSpacingAndGlyphs);
1600 if (!spacingAndGlyphs) {
1601 n -= 1;
1602 }
1603 const qreal delta = chunkShape->layoutInterface()->textLength().customValue - (b - a);
1604
>>> CID 436416: (DIVIDE_BY_ZERO)
>>> In expression "delta / n", division by expression "n" which may be zero has undefined behavior.
1605 const QPointF d = isHorizontal ? QPointF(delta / n, 0) : QPointF(0, delta / n);
1606
1607 QPointF shift;
1608 bool secondTextLengthApplied = false;
1609 Q_FOREACH (int k, visualToLogical.keys()) {
1610 CharacterResult cr = result[visualToLogical.value(k)];
** CID 436415: Null pointer dereferences (NULL_RETURNS)
________________________________________________________________________________________________________
*** CID 436415: Null pointer dereferences (NULL_RETURNS)
/home/tymon/kritadev/krita/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp: 253 in KisAnimTimelineFramesModel::channelByID(QModelIndex, const QString &) const()
247 return srcDummy->node()->keyframeChannels();
248 }
249
250 KisKeyframeChannel *KisAnimTimelineFramesModel::channelByID(QModelIndex index, const QString &id) const
251 {
252 KisNodeDummy *srcDummy = m_d->converter->dummyFromRow(index.row());
>>> CID 436415: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "nullptr" "srcDummy" when calling "node".
253 return srcDummy->node()->getKeyframeChannel(id);
254 }
255
256 void KisAnimTimelineFramesModel::setDummiesFacade(KisDummiesFacadeBase *dummiesFacade,
257 KisImageSP image,
258 KisNodeDisplayModeAdapter *displayModeAdapter)
** CID 436414: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/libs/libqml/KisSketchView.cpp: 121 in KisSketchView::~KisSketchView()()
________________________________________________________________________________________________________
*** CID 436414: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/libs/libqml/KisSketchView.cpp: 121 in KisSketchView::~KisSketchView()()
115
116 if (DocumentManager::instance()->document()) {
117 documentChanged();
118 }
119 }
120
>>> CID 436414: Error handling issues (UNCAUGHT_EXCEPT)
>>> An exception of type "boost::wrapexcept<boost::bad_get>" is thrown but the exception specification "noexcept" doesn't allow it to be thrown. This will result in a call to terminate().
121 KisSketchView::~KisSketchView()
122 {
123 if (d->doc) {
124 DocumentManager::instance()->closeDocument();
125 }
126 if (d->canvasWidget) {
** CID 436413: Uninitialized members (UNINIT_CTOR)
/home/tymon/kritadev/krita/plugins/dockers/advancedcolorselector/KisColorPatchesTableView.cpp: 54 in KisColorPatchesTableView::Private::Private(const QString &)()
________________________________________________________________________________________________________
*** CID 436413: Uninitialized members (UNINIT_CTOR)
/home/tymon/kritadev/krita/plugins/dockers/advancedcolorselector/KisColorPatchesTableView.cpp: 54 in KisColorPatchesTableView::Private::Private(const QString &)()
48 int patchCount {1};
49 bool wasScrollingDisabled {false};
50
51 Private(const QString &configPrefix)
52 : configPrefix(configPrefix)
53 {
>>> CID 436413: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "direction" is not initialized in this constructor nor in any functions that it calls.
54 }
55 };
56
57 KisColorPatchesTableView::KisColorPatchesTableView(const QString &configPrefix, QWidget *parent)
58 : QTableView(parent)
59 , m_d(new KisColorPatchesTableView::Private(configPrefix))
** CID 436412: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 436412: Null pointer dereferences (FORWARD_NULL)
/home/tymon/kritadev/krita/libs/flake/text/KoSvgTextShape.cpp: 2598 in KoSvgTextShape::Private::collectPaths(const KoShape *, QVector<CharacterResult> &, int &)()
2592
2593 // NOLINTNEXTLINE(readability-function-cognitive-complexity)
2594 QList<KoShape *> KoSvgTextShape::Private::collectPaths(const KoShape *rootShape, QVector<CharacterResult> &result, int ¤tIndex)
2595 {
2596 const KoSvgTextChunkShape *chunkShape = dynamic_cast<const KoSvgTextChunkShape *>(rootShape);
2597
>>> CID 436412: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "chunkShape" to "layoutInterface", which dereferences it.
2598 QMap<KoSvgText::TextDecoration, QPainterPath> textDecorations = chunkShape->layoutInterface()->textDecorations();
2599 QColor textDecorationColor = chunkShape->textProperties().propertyOrDefault(KoSvgTextProperties::TextDecorationColorId).value<QColor>();
2600 QSharedPointer<KoShapeBackground> decorationColor = chunkShape->background();
2601 if (textDecorationColor.isValid()) {
2602 decorationColor = QSharedPointer<KoColorBackground>(new KoColorBackground(textDecorationColor));
2603 }
** CID 436411: Error handling issues (CHECKED_RETURN)
/home/tymon/kritadev/krita/plugins/dockers/widegamutcolorselector/WGMyPaintShadeSelector.cpp: 130 in WGMyPaintShadeSelector::paintEvent(QPaintEvent *)()
________________________________________________________________________________________________________
*** CID 436411: Error handling issues (CHECKED_RETURN)
/home/tymon/kritadev/krita/plugins/dockers/widegamutcolorselector/WGMyPaintShadeSelector.cpp: 130 in WGMyPaintShadeSelector::paintEvent(QPaintEvent *)()
124 KisSequentialIterator it(m_realPixelCache, pickRectHighDPI);
125 KisSequentialIterator borderIt(m_realCircleBorder, pickRectHighDPI);
126 QVector4D values, values2;
127
128
129 while (it.nextPixel()) {
>>> CID 436411: Error handling issues (CHECKED_RETURN)
>>> Calling "nextPixel" without checking return value (as is done elsewhere 81 out of 84 times).
130 borderIt.nextPixel();
131
132 int x = it.x();
133 int y = it.y();
134
135 bool needsBlending = getChannelValues(QPoint(x, y), values, values2);
** CID 436410: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/krita/main.cc: 221 in main()
________________________________________________________________________________________________________
*** CID 436410: Error handling issues (UNCAUGHT_EXCEPT)
/home/tymon/kritadev/krita/krita/main.cc: 221 in main()
215 #define MAIN_FN krita_main
216 #else
217 #define MAIN_EXPORT
218 #define MAIN_FN main
219 #endif
220
>>> CID 436410: Error handling issues (UNCAUGHT_EXCEPT)
>>> In function "main(int, char **)" an exception of type "boost::wrapexcept<boost::bad_get>" is thrown and never caught.
221 extern "C" MAIN_EXPORT int MAIN_FN(int argc, char **argv)
222 {
223 #ifdef Q_OS_WIN
224 // Fix QCommandLineParser help output with UTF-8 codepage:
225 if (GetACP() == CP_UTF8) {
226 SetConsoleOutputCP(CP_UTF8);
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yoiVvSSc0Ywjss83d7yOEUgcCB0VGS755ZaA-2FhoVtwbuw-3D-3DCo_R_9IaX5f-2FHpKL9E6YDsrt7GXrayr4Tk6CKCUhJvkNHrt4POgNOIOFwG5a0nPmTO2nssx233MPvNYIBCZgWKY8QajAeyC3eD3OmF5ipUa1CacExxtg55lZsk33GJFDR46ki8TVI2HKnYx6GAlhOw3vgZBpc8CsmdbleDlQx1h3dG8ffSUz4gCAZUST9yKmEcU0GvVmFuiiqvUfxQbl1yf-2B5vA-3D-3D
More information about the kimageshop
mailing list