New Defects reported by Coverity Scan for rhabacker/umbrello
scan-admin at coverity.com
scan-admin at coverity.com
Mon Mar 9 09:48:35 GMT 2020
Hi,
Please find the latest report on new defect(s) introduced to rhabacker/umbrello found with Coverity Scan.
41 new defect(s) introduced to rhabacker/umbrello found with Coverity Scan.
39 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 20 of 41 defect(s)
** CID 268401: Security best practices violations (STRING_OVERFLOW)
/root/src/umbrello/umbrello/docgenerators/docbookgeneratorjob.cpp: 73 in xsltprocExternalEntityLoader(const char *, const char *, _xmlParserCtxt *)()
________________________________________________________________________________________________________
*** CID 268401: Security best practices violations (STRING_OVERFLOW)
/root/src/umbrello/umbrello/docgenerators/docbookgeneratorjob.cpp: 73 in xsltprocExternalEntityLoader(const char *, const char *, _xmlParserCtxt *)()
67 {
68 url.replace(i.key(),i.value());
69 qDebug() << "converted" << _URL << "to" << url;
70 }
71 }
72 char URL[1024];
>>> CID 268401: Security best practices violations (STRING_OVERFLOW)
>>> You might overrun the 1024-character fixed-size string "URL" by copying the return value of "constData" without checking the length.
73 strcpy(URL,url.toLatin1().constData());
74
75 const char *lastsegment = URL;
76 const char *iter = URL;
77
78 if (nbpaths > 0) {
** CID 268400: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 873 in Widget_Utils::defaultWidgetName(WidgetBase::WidgetType)()
________________________________________________________________________________________________________
*** CID 268400: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 873 in Widget_Utils::defaultWidgetName(WidgetBase::WidgetType)()
867 case WidgetBase::wt_UseCase: return i18n("new use case");
868 default:
869 uWarning() << "unknown widget type:" << WidgetBase::toString(type);
870 return i18n("new widget");
871 break;
872 }
>>> CID 268400: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "return QString();".
873 return QString();
874 }
875
876 /**
877 * Returns translated title string used by widget related dialogs
878 * @param type widget type
** CID 268399: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/menus/listpopupmenu.cpp: 58 in DebugMenu::DebugMenu(const QString &)()
________________________________________________________________________________________________________
*** CID 268399: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/menus/listpopupmenu.cpp: 58 in DebugMenu::DebugMenu(const QString &)()
52 // uncomment to see not handled switch cases
53 //#define CHECK_SWITCH
54
55 class DebugMenu {
56 public:
57 DebugMenu(ListPopupMenu::MenuType _m) : m(_m) {}
>>> CID 268399: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "m" is not initialized in this constructor nor in any functions that it calls.
58 DebugMenu(const QString & _m) : menu(_m) {}
59 ListPopupMenu::MenuType m;
60 QString menu;
61 };
62
63 class ListPopupMenuPrivate {
** CID 268398: Incorrect expression (DIVIDE_BY_ZERO)
________________________________________________________________________________________________________
*** CID 268398: Incorrect expression (DIVIDE_BY_ZERO)
/root/src/umbrello/umbrello/umldoc.cpp: 508 in UMLDoc::openDocument(const KUrl &, const char *)()
502 newDocument();
503 return false;
504 }
505
506 m_doc_url = url;
507 closeDocument();
>>> CID 268398: Incorrect expression (DIVIDE_BY_ZERO)
>>> In function call "setResolution", division by expression "0." has undefined behavior.
508 setResolution(0.0);
509 // IMPORTANT: set m_bLoading to true
510 // _AFTER_ the call of UMLDoc::closeDocument()
511 // as it sets m_bLoading to false after it was temporarily
512 // changed to true to block recording of changes in redo-buffer
513 m_bLoading = true;
** CID 268397: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/dialogs/pages/generaloptionpage.cpp: 172 in GeneralOptionPage::GeneralOptionPage(QWidget *)()
________________________________________________________________________________________________________
*** CID 268397: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/dialogs/pages/generaloptionpage.cpp: 172 in GeneralOptionPage::GeneralOptionPage(QWidget *)()
166 QString language = Uml::ProgrammingLanguage::toString(Uml::ProgrammingLanguage::fromInt(indexCounter));
167 m_GeneralWidgets.languageKB->insertItem(indexCounter, language);
168 indexCounter++;
169 }
170 m_GeneralWidgets.languageKB->setCurrentIndex(optionState.generalState.defaultLanguage);
171 topLayout->addWidget(m_GeneralWidgets.startupGB);
>>> CID 268397: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member field "m_GeneralWidgets.layoutTypeW" is not initialized in this constructor nor in any functions that it calls.
172 }
173
174 /**
175 * Destructor.
176 */
177 GeneralOptionPage::~GeneralOptionPage()
** CID 268396: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 268396: Null pointer dereferences (FORWARD_NULL)
/root/src/umbrello/umbrello/dotgenerator.cpp: 457 in DotGenerator::createDotFile(UMLScene *, const QString &, const QString &)()
451 if (!widget->isTextWidget())
452 out << "\"" << id << "\""
453 << " [" << params.join(QLatin1String(",")) << "];\n";
454 // add associations for child items
455 foreach(QGraphicsItem *item, widget->childItems()) {
456 UMLWidget *w2 = dynamic_cast<UMLWidget *>(item);
>>> CID 268396: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "w2" to "dotType", which dereferences it.
457 QString type2 = dotType(w2);
458 QString id2 = fixID(Uml::ID::toString(w2->localID()));
459 QStringList params2;
460 QString vkey = QString(QLatin1String("visual::type::%1::%2")).arg(type).arg(type2);
461 if (m_edgeParameters.contains(vkey)) {
462 params2 << m_edgeParameters[vkey];
** CID 268395: Control flow issues (MISSING_BREAK)
/root/src/umbrello/umbrello/umlwidgets/associationline.cpp: 527 in AssociationLine::reconstructSymbols()()
________________________________________________________________________________________________________
*** CID 268395: Control flow issues (MISSING_BREAK)
/root/src/umbrello/umbrello/umlwidgets/associationline.cpp: 527 in AssociationLine::reconstructSymbols()()
521 *
522 * Call this method when associationType of m_associationWidget changes.
523 */
524 void AssociationLine::reconstructSymbols()
525 {
526 switch( m_associationWidget->associationType() ) {
>>> CID 268395: Control flow issues (MISSING_BREAK)
>>> The case for value "Uml::AssociationType::Exception" is not terminated by a 'break' statement.
527 case Uml::AssociationType::Exception:
528 setLayout(Uml::LayoutType::Polyline);
529 case Uml::AssociationType::State:
530 case Uml::AssociationType::Activity:
531 case Uml::AssociationType::UniAssociation:
532 case Uml::AssociationType::Dependency:
** CID 268394: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/model_utils.cpp: 648 in Model_Utils::newText(UMLObject::ObjectType)()
________________________________________________________________________________________________________
*** CID 268394: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/model_utils.cpp: 648 in Model_Utils::newText(UMLObject::ObjectType)()
642 case UMLObject::ot_UniqueConstraint: return i18n("Enter the name of the new unique constraint:");
643 case UMLObject::ot_UseCase: return i18n("Enter the name of the new use case:");
644 default:
645 uWarning() << "unknown object type" << UMLObject::toString(type);
646 return i18n("Enter the name of the new UML object");
647 }
>>> CID 268394: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "return QString();".
648 return QString();
649 }
650
651 /**
652 * Returns translated title string used by uml object related dialogs
653 * @param type uml object type
** CID 268393: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/dotgenerator.cpp: 152 in DotGenerator::DotGenerator()()
________________________________________________________________________________________________________
*** CID 268393: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/dotgenerator.cpp: 152 in DotGenerator::DotGenerator()()
146 if (optionState.autoLayoutState.autoDotPath) {
147 m_dotPath = currentDotPath();
148 }
149 else if (!optionState.autoLayoutState.dotPath.isEmpty()) {
150 m_dotPath = optionState.autoLayoutState.dotPath;
151 }
>>> CID 268393: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "m_version" is not initialized in this constructor nor in any functions that it calls.
152 }
153
154 /**
155 * Return the path where dot is installed.
156 *
157 * @return string with dot path
** CID 268392: Control flow issues (DEADCODE)
/root/src/umbrello/umbrello/diagram_utils.cpp: 416 in Diagram_Utils::importGraph(const QStringList &, UMLScene *, const QString &)()
________________________________________________________________________________________________________
*** CID 268392: Control flow issues (DEADCODE)
/root/src/umbrello/umbrello/diagram_utils.cpp: 416 in Diagram_Utils::importGraph(const QStringList &, UMLScene *, const QString &)()
410 umldoc->addAssociation(assoc);
411 }
412 AssociationWidget* aw = AssociationWidget::create(scene, w1, type, w2, assoc);
413 scene->addAssociation(aw);
414 } else {
415 if (assoc)
>>> CID 268392: Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "if (assoc) {
assoc->~UMLA...".
416 delete assoc;
417 QString item = QString::fromLatin1("%1:%2:%3: %4: %5")
418 .arg(fileName).arg(lineNumber)
419 .arg(1).arg(line).arg(QLatin1String("error:could not add association"));
420 UMLApp::app()->logWindow()->addItem(item);
421 }
** CID 268391: Memory - illegal accesses (OVERRUN)
/root/src/umbrello/umbrello/umldoc.cpp: 2924 in UMLDoc::loadDiagramsFromXMI1(QDomNode &)()
________________________________________________________________________________________________________
*** CID 268391: Memory - illegal accesses (OVERRUN)
/root/src/umbrello/umbrello/umldoc.cpp: 2924 in UMLDoc::loadDiagramsFromXMI1(QDomNode &)()
2918 delete pView;
2919 return false;
2920 }
2921 // Put diagram in default predefined folder.
2922 // @todo pass in the parent folder - it might be a user defined one.
2923 Uml::ModelType::Enum mt = Model_Utils::convert_DT_MT(pView->umlScene()->type());
>>> CID 268391: Memory - illegal accesses (OVERRUN)
>>> Overrunning array "this->m_root" of 5 8-byte elements at element index 5 (byte offset 47) using index "mt" (which evaluates to 5).
2924 pView->umlScene()->setFolder(m_root[mt]);
2925 pView->hide();
2926 addView(pView);
2927 emit sigSetStatusbarProgress(++count);
2928 qApp->processEvents(); // give UI events a chance
2929 }
** CID 268390: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 965 in Widget_Utils::newText(WidgetBase::WidgetType)()
________________________________________________________________________________________________________
*** CID 268390: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 965 in Widget_Utils::newText(WidgetBase::WidgetType)()
959 case WidgetBase::wt_UMLWidget: return i18n("Enter the name of the new uml widget:");
960 case WidgetBase::wt_UseCase: return i18n("Enter the name of the new use case:");
961 default:
962 uWarning() << "unknown widget type:" << WidgetBase::toString(type);
963 return i18n("Enter the name of the new widget:");
964 }
>>> CID 268390: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "return QString();".
965 return QString();
966 }
967
968 /**
969 * Returns translated title string used by widget related dialogs
970 * @param type widget type
** CID 268389: Null pointer dereferences (FORWARD_NULL)
/root/src/umbrello/umbrello/docgenerators/docbookgeneratorjob.cpp: 107 in xsltprocExternalEntityLoader(const char *, const char *, _xmlParserCtxt *)()
________________________________________________________________________________________________________
*** CID 268389: Null pointer dereferences (FORWARD_NULL)
/root/src/umbrello/umbrello/docgenerators/docbookgeneratorjob.cpp: 107 in xsltprocExternalEntityLoader(const char *, const char *, _xmlParserCtxt *)()
101 xmlChar *newURL;
102
103 newURL = xmlStrdup((const xmlChar *) paths[i]);
104 newURL = xmlStrcat(newURL, (const xmlChar *) "/");
105 newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
106 if (newURL != NULL) {
>>> CID 268389: Null pointer dereferences (FORWARD_NULL)
>>> Dereferencing null pointer "defaultEntityLoader".
107 ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
108 if (ret != NULL) {
109 if (warning != NULL)
110 ctxt->sax->warning = warning;
111 qDebug() << "Loaded URL=\"" << newURL << "\" ID=\"" << ID << "\"";
112 xmlFree(newURL);
** CID 268388: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/codeimport/codeimport_autogen/YANEA3P7SW/moc_parser.cpp: 76 in Parser::qt_metacall(QMetaObject::Call, int, void **)()
________________________________________________________________________________________________________
*** CID 268388: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/codeimport/codeimport_autogen/YANEA3P7SW/moc_parser.cpp: 76 in Parser::qt_metacall(QMetaObject::Call, int, void **)()
70 return QObject::qt_metacast(_clname);
71 }
72
73 int Parser::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
74 {
75 _id = QObject::qt_metacall(_c, _id, _a);
>>> CID 268388: Incorrect expression (IDENTICAL_BRANCHES)
>>> The same code is executed when the condition "_id < 0" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
76 if (_id < 0)
77 return _id;
78 return _id;
79 }
** CID 268387: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/libumbrello_autogen/FKGKFRHFAN/moc_selectdiagramwidget.cpp: 76 in SelectDiagramWidget::qt_metacall(QMetaObject::Call, int, void **)()
________________________________________________________________________________________________________
*** CID 268387: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/libumbrello_autogen/FKGKFRHFAN/moc_selectdiagramwidget.cpp: 76 in SelectDiagramWidget::qt_metacall(QMetaObject::Call, int, void **)()
70 return ComboBoxWidgetBase::qt_metacast(_clname);
71 }
72
73 int SelectDiagramWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
74 {
75 _id = ComboBoxWidgetBase::qt_metacall(_c, _id, _a);
>>> CID 268387: Incorrect expression (IDENTICAL_BRANCHES)
>>> The same code is executed when the condition "_id < 0" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
76 if (_id < 0)
77 return _id;
78 return _id;
79 }
** CID 268386: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/libumbrello_autogen/FKGKFRHFAN/moc_comboboxwidgetbase.cpp: 76 in ComboBoxWidgetBase::qt_metacall(QMetaObject::Call, int, void **)()
________________________________________________________________________________________________________
*** CID 268386: Incorrect expression (IDENTICAL_BRANCHES)
/umbrello/libumbrello_autogen/FKGKFRHFAN/moc_comboboxwidgetbase.cpp: 76 in ComboBoxWidgetBase::qt_metacall(QMetaObject::Call, int, void **)()
70 return QWidget::qt_metacast(_clname);
71 }
72
73 int ComboBoxWidgetBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
74 {
75 _id = QWidget::qt_metacall(_c, _id, _a);
>>> CID 268386: Incorrect expression (IDENTICAL_BRANCHES)
>>> The same code is executed when the condition "_id < 0" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
76 if (_id < 0)
77 return _id;
78 return _id;
79 }
** CID 268385: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 1011 in Widget_Utils::renameTitle(WidgetBase::WidgetType)()
________________________________________________________________________________________________________
*** CID 268385: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 1011 in Widget_Utils::renameTitle(WidgetBase::WidgetType)()
1005 case WidgetBase::wt_UMLWidget: return i18n("Rename UML widget");
1006 case WidgetBase::wt_UseCase: return i18n("Rename use case");
1007 default:
1008 uWarning() << "unknown widget type:" << WidgetBase::toString(type);
1009 return i18n("Rename widget");
1010 }
>>> CID 268385: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "return QString();".
1011 return QString();
1012 }
1013
1014 /**
1015 * Returns translated text string used by widget related dialogs
1016 * @param type widget type
** CID 268384: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 1057 in Widget_Utils::renameText(WidgetBase::WidgetType)()
________________________________________________________________________________________________________
*** CID 268384: Control flow issues (UNREACHABLE)
/root/src/umbrello/umbrello/umlwidgets/widget_utils.cpp: 1057 in Widget_Utils::renameText(WidgetBase::WidgetType)()
1051 case WidgetBase::wt_UMLWidget: return i18n("Enter the new name of the uml widget:");
1052 case WidgetBase::wt_UseCase: return i18n("Enter the new name of the use case:");
1053 default:
1054 uWarning() << "unknown widget type:" << WidgetBase::toString(type);
1055 return i18n("Enter the new name of the widget:");
1056 }
>>> CID 268384: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "return QString();".
1057 return QString();
1058 }
** CID 268383: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 268383: Null pointer dereferences (FORWARD_NULL)
/root/src/umbrello/umbrello/umlscene.cpp: 183 in UMLScenePrivate::fixPortPositions()()
177 if (w->isPortWidget()) {
178 QGraphicsItem *g = w->parentItem();
179 ComponentWidget *c = dynamic_cast<ComponentWidget*>(g);
180 Q_ASSERT(c);
181 qreal w2 = w->width()/2;
182 qreal h2 = w->height()/2;
>>> CID 268383: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "c" to "width", which dereferences it.
183 if (w->x() <= -w2 || w->y() <= -h2
184 || w->x() >= c->width() - w2
185 || w->y() >= c->height() - h2)
186 continue;
187 if (w->x() >= c->width() - 3 * w2) { // right
188 w->setX(c->width() - w2);
** CID 268382: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/umlwidgets/associationline.cpp: 58 in AssociationLine::AssociationLine(AssociationWidget *)()
________________________________________________________________________________________________________
*** CID 268382: Uninitialized members (UNINIT_CTOR)
/root/src/umbrello/umbrello/umlwidgets/associationline.cpp: 58 in AssociationLine::AssociationLine(AssociationWidget *)()
52 m_autoLayoutSpline(true)
53 {
54 Q_ASSERT(association);
55 setFlag(QGraphicsLineItem::ItemIsSelectable);
56 setAcceptHoverEvents(true);
57 setZValue(3);
>>> CID 268382: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "c2dy" is not initialized in this constructor nor in any functions that it calls.
58 }
59
60 /**
61 * Destructor.
62 */
63 AssociationLine::~AssociationLine()
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/ls/click?upn=nJaKvJSIH-2FPAfmty-2BK5tYpPklAc1eEA-2F1zfUjH6teEznF6-2BySdRKaBxnmSJpxC-2FP1BIyQTm3G-2BJNtkFeeufx-2BNDm4Po0UCCupkbAws6PJfo-3DkFZH_ayU2l2PDk8Uz8GVXtvS4zFCjP9BmHG9-2FEq6MRz3uuYQ0yc3w-2FjmHmuRorsLdse3NIbBdLLg1I-2BcWYDZovIIj5nPxgCffrYM4E5aahWvGaWp-2BfUGc5-2FRYxvreQOMNgQ9kSgMfUFc7UIUCSsnLR2SfQzCMcuG5gPl9pggp2xcx5OGRy7KXUT-2BUvvob09UQeQ3LUXwkzs1nrbFJ9LbEAx7ma3cI1SkQIMyqUh1Q8S5N6ZoEqQ5CkKbKPZfh1AaqFsB9
More information about the umbrello-devel
mailing list