Skip to content

Commit 3cb3c36

Browse files
committed
Fixed crash when a section contains a \ref to itself
1 parent 61db5c6 commit 3cb3c36

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/docnode.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,17 @@ void DocRef::parse()
841841

842842
if (children().empty() && !m_text.isEmpty())
843843
{
844+
QCString text = m_text;
845+
if (parser()->context.insideHtmlLink)
846+
{
847+
// we already in a link/title only output anchor
848+
text = m_anchor;
849+
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
850+
"Potential recursion while resolving \\ref command!");
851+
}
844852
parser()->context.insideHtmlLink=TRUE;
845853
parser()->pushContext();
846-
parser()->internalValidatingParseDoc(thisVariant(),children(),m_text);
854+
parser()->internalValidatingParseDoc(thisVariant(),children(),text);
847855
parser()->popContext();
848856
parser()->context.insideHtmlLink=FALSE;
849857
parser()->tokenizer.setStatePara();

0 commit comments

Comments
 (0)