Skip to content

Commit b58548e

Browse files
committed
issue doxygen#11333 rebuilding fedora ignition-transport causes abort in isExplicitPage with doxygen 1.13.1
1 parent 8172a20 commit b58548e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/markdown.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ int Markdown::Private::processHtmlTagWrite(std::string_view data,size_t offset,b
10481048
{
10491049
if (l>0 && i<size)
10501050
{
1051-
if (data[i]=='/' && i<size-1 && data[i+1]=='>') // <bla/>
1051+
if (data[i]=='/' && i+1<size && data[i+1]=='>') // <bla/>
10521052
{
10531053
//printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+2)));
10541054
if (doWrite) out+=data.substr(0,i+2);
@@ -1650,7 +1650,7 @@ int Markdown::Private::processCodeSpan(std::string_view data,size_t)
16501650
pc = '\n';
16511651
i = 0;
16521652
}
1653-
else if (data[end]=='\'' && nb==1 && (end==size-1 || (end<size-1 && !isIdChar(data[end+1]))))
1653+
else if (data[end]=='\'' && nb==1 && (end==size-1 || (end+1<size && !isIdChar(data[end+1]))))
16541654
{ // look for quoted strings like 'some word', but skip strings like `it's cool`
16551655
out+="&lsquo;";
16561656
out+=data.substr(nb,end-nb);
@@ -2133,7 +2133,7 @@ static size_t computeIndentExcludingListMarkers(std::string_view data)
21332133
(data[i]=='+' || data[i]=='-' || data[i]=='*' || // unordered list char
21342134
(data[i]=='#' && i>0 && data[i-1]=='-') || // -# item
21352135
(isDigit=(data[i]>='1' && data[i]<='9')) || // ordered list marker?
2136-
(isLi=(size>=3 && i<size-3 && isLiTag(i))) // <li> tag
2136+
(isLi=(size>=3 && i+3<size && isLiTag(i))) // <li> tag
21372137
)
21382138
)
21392139
)
@@ -2146,7 +2146,7 @@ static size_t computeIndentExcludingListMarkers(std::string_view data)
21462146
{
21472147
if (data[j]=='.') // should be end of the list marker
21482148
{
2149-
if (j<size-1 && data[j+1]==' ') // valid list marker
2149+
if (j+1<size && data[j+1]==' ') // valid list marker
21502150
{
21512151
listMarkerSkipped=TRUE;
21522152
indent+=j+1-i;
@@ -2167,13 +2167,13 @@ static size_t computeIndentExcludingListMarkers(std::string_view data)
21672167
indent+=3;
21682168
listMarkerSkipped=TRUE;
21692169
}
2170-
else if (data[i]=='-' && size>=2 && i<size-2 && data[i+1]=='#' && data[i+2]==' ')
2170+
else if (data[i]=='-' && size>=2 && i+2<size && data[i+1]=='#' && data[i+2]==' ')
21712171
{ // case "-# "
21722172
listMarkerSkipped=TRUE; // only a single list marker is accepted
21732173
i++; // skip over #
21742174
indent++;
21752175
}
2176-
else if (data[i]!=' ' && i<size-1 && data[i+1]==' ')
2176+
else if (data[i]!=' ' && i+1<size && data[i+1]==' ')
21772177
{ // case "- " or "+ " or "* "
21782178
listMarkerSkipped=TRUE; // only a single list marker is accepted
21792179
}
@@ -2892,7 +2892,7 @@ bool skipOverFileAndLineCommands(std::string_view data,size_t indent,size_t &off
28922892
if (i>offset) locStart--; // include the space before \ifile
28932893
i+=8;
28942894
bool found=false;
2895-
while (i<size-9 && data[i]!='\n')
2895+
while (i+9<size && data[i]!='\n')
28962896
{
28972897
if (data[i]=='\\' && qstrncmp(&data[i+1],"ilinebr ",8)==0)
28982898
{
@@ -3002,7 +3002,7 @@ size_t Markdown::Private::findEndOfLine(std::string_view data,size_t offset)
30023002
if (!endBlockName.isEmpty())
30033003
{
30043004
size_t l = endBlockName.length();
3005-
for (;end<size-l-1;end++) // search for end of block marker
3005+
for (;end+l+1<size;end++) // search for end of block marker
30063006
{
30073007
if ((data[end]=='\\' || data[end]=='@') &&
30083008
data[end-1]!='\\' && data[end-1]!='@'
@@ -3019,7 +3019,7 @@ size_t Markdown::Private::findEndOfLine(std::string_view data,size_t offset)
30193019
}
30203020
}
30213021
}
3022-
else if (nb==0 && data[end-1]=='<' && size>=6 && end<size-6 &&
3022+
else if (nb==0 && data[end-1]=='<' && size>=6 && end+6<size &&
30233023
(end<=1 || (data[end-2]!='\\' && data[end-2]!='@'))
30243024
)
30253025
{
@@ -3455,15 +3455,15 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34553455
{
34563456
i++;
34573457
}
3458-
if (i<size-5 && data[i]=='<' && qstrncmp(&data[i],"<!--!",5)==0) // skip over <!--! marker
3458+
if (i+5<size && data[i]=='<' && qstrncmp(&data[i],"<!--!",5)==0) // skip over <!--! marker
34593459
{
34603460
i+=5;
34613461
while (i<size && (data[i]==' ' || data[i]=='\n')) // skip over spaces after the <!--! marker
34623462
{
34633463
i++;
34643464
}
34653465
}
3466-
if (i<size-1 &&
3466+
if (i+1<size &&
34673467
(data[i]=='\\' || data[i]=='@') &&
34683468
(qstrncmp(&data[i+1],"page ",5)==0 || qstrncmp(&data[i+1],"mainpage",8)==0)
34693469
)
@@ -3479,7 +3479,7 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34793479
return ExplicitPageResult::explicitMainPage;
34803480
}
34813481
}
3482-
else if (i<size-1 &&
3482+
else if (i+1<size &&
34833483
(data[i]=='\\' || data[i]=='@') &&
34843484
(qstrncmp(&data[i+1],"dir\n",4)==0 || qstrncmp(&data[i+1],"dir ",4)==0)
34853485
)

0 commit comments

Comments
 (0)