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>
bb10
Martin Smith 2015-05-28 11:24:24 +02:00
parent 8b1746b09d
commit 0dd0d2f9d5
1 changed files with 2 additions and 1 deletions

View File

@ -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;