Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47404

QProcess/Win crash on empty program and args

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.5.1
    • 5.4.2, 5.5.0
    • Core: I/O
    • None
    • edb5f22b0a5f791728951bc77e272279e06b6ab6

    Description

      QProcess will crash on Windows when passing an empty program and an empty argument list.

      #include <QCoreApplication>
      #include <QProcess>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          QProcess p;
          p.start(QString(), QStringList());
          return a.exec();
      }
      

      The reason is that the QString args whose buffer is passed to CreateProcess is a null QString in this case.
      The QString args points to readonly memory. However, CreateProcess must be able to modify the argument buffer.

      Note that the following code is not affected:

          QProcess p;
          p.start(QString());
      

      In this case QProcess::start() bails out if the argument is empty.

      Attachments

        For Gerrit Dashboard: QTBUG-47404
        # Subject Branch Project Status CR V

        Activity

          People

            jbornema Joerg Bornemann
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes