Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-18331

Possible defects in the source code

    XMLWordPrintable

Details

    Description

       

      Hi!

      Please, check these parts of the code, maybe there's an error here:

      1) src/plugins/debugger/watchhandler.cpp#L2279-L2282

       

      else if (format == DisplayUtf16String)
      str = QString::fromUtf16((ushort *)ba.constData(), ba.size() / 2);
      else if (format == DisplayUtf16String)
      str = QString::fromUcs4((uint *)ba.constData(), ba.size() / 4);
      

      DisplayUtf16String is compared twcie.

      Probably, it should be:

      else if (format == DisplayUtf16String)
      str = QString::fromUtf16((ushort *)ba.constData(), ba.size() / 2);
      else if (format == DisplayUcs4String)
      str = QString::fromUcs4((uint *)ba.constData(), ba.size() / 4);

       2) src/plugins/cppeditor/cppeditor.cpp#L468-L471

       

       

      if (projectParts.isEmpty())
      projectParts = modelManager->projectPartFromDependencies(filePath);
      else if (projectParts.isEmpty())
      projectParts.append(modelManager->fallbackProjectPart());
      

      Second if-statement is never executed.

       

      3) src/plugins/android/androidrunner.cpp#L780

       

      if (!m_runConfig->target() && !m_runConfig->target()->project())
      
      

      if 'm_runConfig->target(), then expression !m_runConfig->target() is true, so 

      expression 'm_runConfig->target()->project()' will be executed - null pointer dereference

      4) No bug, just redundant code :

      src/plugins/qmljseditor/qmljshighlighter.cpp

       

      if (ch == QLatin1Char('p') && text == QLatin1String("property"))
        return true
      ...
      else if (ch == QLatin1Char('p') && text == QLatin1String("property"))
        return true

       

       

      These possible defects found by AppChecker

       

       

       

      Attachments

        Activity

          People

            rlohning Robert Löhning
            appchecker AppChecker
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: