Commit 1f8de24e authored by con's avatar con Committed by Eike Ziller
Browse files

Global regexp search would eat all memory for matched empty lines.

E.g. for '^$'. also for '.*'

Task-number: QTCREATORBUG-4443
Change-Id: Ic164361ccdf791c2d0ec3c6ec501e34c9ec3fda6
Reviewed-on: http://codereview.qt.nokia.com/681

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 51112975
......@@ -245,13 +245,18 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResultList> &future,
QString line;
while (!stream.atEnd()) {
line = stream.readLine();
int lengthOfLine = line.size();
int pos = 0;
while ((pos = expression.indexIn(line, pos)) != -1) {
results << FileSearchResult(s, lineNr, line,
pos, expression.matchedLength(),
expression.capturedTexts());
++numMatches;
if (expression.matchedLength() == 0)
break;
pos += expression.matchedLength();
if (pos >= lengthOfLine)
break;
}
++lineNr;
}
......
Supports Markdown
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