diff options
author | ck <qt-info@nokia.com> | 2010-01-14 14:41:02 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2010-01-14 14:41:02 (GMT) |
commit | 035bb4a1363443df7bb3fd80f0b2e7d548f3d3a1 (patch) | |
tree | 32db664f493a2280fae24ea0e7c66129951c1914 /tools/assistant/lib/qhelp_global.cpp | |
parent | 9b59e3a664ef1162e0f90ba7e7fe9356bae05d74 (diff) | |
download | Qt-035bb4a1363443df7bb3fd80f0b2e7d548f3d3a1.zip Qt-035bb4a1363443df7bb3fd80f0b2e7d548f3d3a1.tar.gz Qt-035bb4a1363443df7bb3fd80f0b2e7d548f3d3a1.tar.bz2 |
Assistant: Fix bug that can lead to infinite loop in edge cases.
Diffstat (limited to 'tools/assistant/lib/qhelp_global.cpp')
-rw-r--r-- | tools/assistant/lib/qhelp_global.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index e6a26c4..8e96b55 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -89,10 +89,11 @@ QString QHelpGlobal::codecFromHtmlData(const QByteArray &data) QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size())); int start = head.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); if (start > 0) { - int end; QRegExp r(QLatin1String("charset=([^\"\\s]+)")); while (start != -1) { - end = head.indexOf(QLatin1Char('>'), start) + 1; + const int end = head.indexOf(QLatin1Char('>'), start) + 1; + if (end <= start) + break; const QString &meta = head.mid(start, end - start).toLower(); if (r.indexIn(meta) != -1) return r.cap(1); |