summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-03-31 13:19:07 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-03-31 13:25:26 (GMT)
commit2d13592054d1d6f049ecc1599913cb8c7541ef69 (patch)
tree9641ba999af5df2b09d4159dde924d21a2818a59 /src
parent9562f4a39ca9ca2c59bd621ac8e33af8b8006043 (diff)
downloadQt-2d13592054d1d6f049ecc1599913cb8c7541ef69.zip
Qt-2d13592054d1d6f049ecc1599913cb8c7541ef69.tar.gz
Qt-2d13592054d1d6f049ecc1599913cb8c7541ef69.tar.bz2
QProcess::start() segfaults on empty program
Handle cases where QProcess::start() and startDetached() are passed a null, empty, or "invalid" program string instead of crashing. Task-number: 247865 Reviewed-by: Andreas Aardal Hanssen
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index a9d8ee2..f16f996 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1601,6 +1601,13 @@ static QStringList parseCombinedArgString(const QString &program)
void QProcess::start(const QString &program, OpenMode mode)
{
QStringList args = parseCombinedArgString(program);
+ if (args.isEmpty()) {
+ Q_D(QProcess);
+ d->processError = QProcess::FailedToStart;
+ setErrorString(tr("No program defined"));
+ emit error(d->processError);
+ return;
+ }
QString prog = args.first();
args.removeFirst();
@@ -1769,6 +1776,8 @@ bool QProcess::startDetached(const QString &program,
bool QProcess::startDetached(const QString &program)
{
QStringList args = parseCombinedArgString(program);
+ if (args.isEmpty())
+ return false;
QString prog = args.first();
args.removeFirst();