summaryrefslogtreecommitdiff
path: root/src/assistant
diff options
context:
space:
mode:
authorVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2022-03-15 15:21:30 +0100
committerVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2022-03-16 09:26:00 +0000
commit99ba60bad93c78398c47e39b35b07b4074ca2c42 (patch)
treeebe8f59e18d8fdc42518eb6464351c3b0c8dc7c8 /src/assistant
parent7e3387a36a7f37b74a02936814f13aa6050c9370 (diff)
downloadqttools-99ba60bad93c78398c47e39b35b07b4074ca2c42.tar.gz
qhelpgenerator: Fix infinite loop issue in checkLinks
The while loop that looks for the next match, depends on the offset to move to the next match. Even before this offset is updated, the loop is continued if the first capture group of the `linkPattern` regex contains the sequence "://", making the loop to iterate over the same match. Getting all the matches at once and iterating over them is probably a better alternative. Amends 85803440b28aadd3f4fe3e99a52e52378671b9e0 Pick-to: 6.2 6.3 Fixes: QTBUG-101070 Change-Id: I0acd4428244398ccfbb88e042229a928c234b951 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/assistant')
-rw-r--r--src/assistant/qhelpgenerator/helpgenerator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/assistant/qhelpgenerator/helpgenerator.cpp b/src/assistant/qhelpgenerator/helpgenerator.cpp
index 47a11163f..6407bbbf0 100644
--- a/src/assistant/qhelpgenerator/helpgenerator.cpp
+++ b/src/assistant/qhelpgenerator/helpgenerator.cpp
@@ -817,6 +817,7 @@ bool HelpGeneratorPrivate::checkLinks(const QHelpProjectData &helpData)
QRegularExpressionMatch match;
int pos = 0;
while ((match = linkPattern.match(content, pos)).hasMatch()) {
+ pos = match.capturedEnd();
const QString &linkedFileName = match.captured(1);
if (linkedFileName.contains(QLatin1String("://")))
continue;
@@ -830,7 +831,6 @@ bool HelpGeneratorPrivate::checkLinks(const QHelpProjectData &helpData)
allLinksOk = false;
invalidLinks.append(canonicalLinkedFileName);
}
- pos = match.capturedEnd();
}
}