Commit b2ea28c7 authored by David Schulz's avatar David Schulz

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's avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
parent 6b267134
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment