diff options
author | David Schulz <david.schulz@qt.io> | 2017-01-24 08:40:32 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2017-01-24 14:29:09 +0000 |
commit | b2ea28c79eb633bbccf7c3c44a0a9889fe2b7091 (patch) | |
tree | 46179a46ff1f49b1e22c3d23c49f1d8484cb2562 | |
parent | 6b267134444e44381b6e4ed1d319fefa1c58b883 (diff) |
fix crash by guarding QString::setRawData
QString::lastIndexOf can return a -1 if the pattern was not found. Using
a QString that was created by QString::setRawData with a size of -1 will
result in a crash.
Change-Id: Ie02645f00db7e7150424ca367095a7ebc9051578
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r-- | src/shared/proparser/profileevaluator.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 99f4fe0262..60319672a4 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -152,6 +152,10 @@ QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::absoluteFileValues( } { int nameOff = absEl.lastIndexOf(QLatin1Char('/')); + if (nameOff < 0) { + // The entry is garbage (possibly after env var expansion) + goto next; + } QString absDir = d->m_tmp1.setRawData(absEl.constData(), nameOff); if (IoUtils::exists(absDir)) { QString wildcard = d->m_tmp2.setRawData(absEl.constData() + nameOff + 1, |