[doxygen] Fix crash on unclosed HTML tag

Fixes #1935
This commit is contained in:
Olly Betts 2022-01-26 15:12:21 +13:00
commit 0a7192ce8b
4 changed files with 15 additions and 1 deletions

View file

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress)
===========================
2022-01-26: olly
#1935 Don't crash on an unclosed HTML tag in a doxygen comment
when -doxygen is specified.
2022-01-25: olly
Constant expressions now support member access with `.` such as
`foo.bar`. Previous this only worked in a case like `x->foo.bar`.

View file

@ -0,0 +1,6 @@
%module xxx
/**
* Return a random variate with uniform distribution in the range [a,b), where a<b
*/
double uniform(double a, double b);

View file

@ -0,0 +1 @@
doxygen_unclosed_tag.i:4: Warning 563: Doxygen HTML error for tag b: HTML tag without '>' found.

View file

@ -1241,6 +1241,9 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) {
// prepend '<' to distinguish HTML tags from doxygen commands
if (!cmd.empty() && addDoxyCommand(m_tokenList, '<' + cmd)) {
// it is a valid HTML command
if (pos == string::npos) {
pos = line.size();
}
if (line[pos] != '>') {
// it should be HTML tag with args,
// for example <A ...>, <IMG ...>, ...
@ -1266,7 +1269,7 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) {
}
}
if (pos != string::npos) {
if (pos < line.size()) {
pos++; // skip '>'
}
} else {