Description
The "unix" implementation of QProcess::waitForStarted() crashes if start() failed. This can be triggered by, for example, passing a non-existent path to setStandardInputFile(). While this can be avoided by checking error() after calling start() (and before calling waitForStarted()), it probably shouldn't crash either.
I've done some source-code digging and pinpointed the problem:
- QProcessPrivate::startProcess() returns without setting up childStartedPipe if some setup failed.
- QProcessPrivate::waitForStarted() does an FD_SET() with the read end of the pipe, which is -1 because the pipe was not set up.
- FD_SET() crashes with a negative file descriptor.
I guess this could be fixed by simply checking childStartedPipe in QProcessPrivate::waitForStarted() and returning false if it's not set up. That would also catch accidentally calling waitForStarted() without calling start() at all.
Note: I encountered the problem with Qt 4.8.1 (as currently shipped with ubuntu 12.04). I also checked the latest Qt5 sources from git and the problem seems to be the same there, but I have not tested that.
Attachments
Issue Links
- is replaced by
-
QTBUG-32958 Crash when added empty deploy step
-
- Closed
-