diff --git a/CHANGES.current b/CHANGES.current index b70946f5d..bee40f3f2 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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`. diff --git a/Examples/test-suite/errors/doxygen_unclosed_tag.i b/Examples/test-suite/errors/doxygen_unclosed_tag.i new file mode 100644 index 000000000..fbc359627 --- /dev/null +++ b/Examples/test-suite/errors/doxygen_unclosed_tag.i @@ -0,0 +1,6 @@ +%module xxx + +/** + * Return a random variate with uniform distribution in the range [a,b), where a' found. diff --git a/Source/Doxygen/doxyparser.cxx b/Source/Doxygen/doxyparser.cxx index d5a0a15eb..baca52e46 100644 --- a/Source/Doxygen/doxyparser.cxx +++ b/Source/Doxygen/doxyparser.cxx @@ -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 , , ... @@ -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 {