summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2015-05-28 11:24:24 +0200
committerMartin Smith <martin.smith@digia.com>2015-06-05 09:39:39 +0000
commit0dd0d2f9d5b333b215848ea3965e3af3dccaf599 (patch)
treeb7319dc47d6def31bf811c798508278c2e269a9a /src/tools/qdoc
parent8b1746b09df51df17befdaccc661ce81a8dfb5e8 (diff)
qdoc: fix invalid memory access in HtmlGenerator
HtmlGenerator::highlightedCode() contained a potential out-of-range- memory reference, which is prevented by this fix. Change-Id: I3bc87a8287e1d51c2786f5ec42384dbac04c9636 Task-number: QTBUG-45643 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc')
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index e80187ec93..d7a17fce26 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -3551,7 +3551,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
bool handled = false;
for (int k = 0; k != 18; ++k) {
const QString & tag = spanTags[2 * k];
- if (tag == QStringRef(&src, i, tag.length())) {
+ if (i + tag.length() <= src.length() &&
+ tag == QStringRef(&src, i, tag.length())) {
html += spanTags[2 * k + 1];
i += tag.length();
handled = true;