[umbrello] [Bug 445119] New: Issues with code ignoring and possibly dereferencing nullptr

"Robert Hairgrove" <[email protected]>
Newsgroups gmane.linux.umbrello.devel
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=445119

            Bug ID: 445119
           Summary: Issues with code ignoring and possibly dereferencing
                    nullptr
           Product: umbrello
           Version: Git
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Using Umbrello from Git/master:

In file "component.cpp" at line 58 in the method "UMLComponent::saveToXMI1()":

  for (UMLObjectListIt objectsIt(m_objects); objectsIt.hasNext();) {
      UMLObject* obj = objectsIt.next();
      uIgnoreZeroPointer(obj);
      obj->saveToXMI1 (writer);
  }

What happens if "obj" == nullptr? A warning is emitted by "uIgnoreZeroPointer",
but "obj" is dereferenced after that anyway, which causes undefined behavior
according to the C++ standard.

I found instances of similar behavior in about 60 other files.

Which gives rise to the next question: Why are null pointers being stored in
the "m_objects" collection? Instead of an error or warning, this should be
handled by an assert() or something similar, causing the program to exit,
preferably in code which appends the pointers to the collection.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.