Merge pull request #1656 from mcfarljm/Issue-1647
Fix doxygen crash with empty comment (Issue #1647)
This commit is contained in:
commit
fa58fd53b4
2 changed files with 6 additions and 2 deletions
|
|
@ -107,6 +107,9 @@ double Atan2(double y, double x)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Regression test for crash with empty comment: */
|
||||||
|
/**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment at the end of file should be ignored.
|
* Comment at the end of file should be ignored.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -435,10 +435,11 @@ static int yylook(void) {
|
||||||
if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/
|
if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/
|
||||||
/* Check for all possible Doxygen comment start markers while ignoring
|
/* Check for all possible Doxygen comment start markers while ignoring
|
||||||
comments starting with a row of asterisks or slashes just as
|
comments starting with a row of asterisks or slashes just as
|
||||||
Doxygen itself does. */
|
Doxygen itself does. Also skip empty comment (slash-star-star-slash),
|
||||||
|
which causes a crash due to begin > end. */
|
||||||
if (Len(cmt) > 3 && loc[0] == '/' &&
|
if (Len(cmt) > 3 && loc[0] == '/' &&
|
||||||
((loc[1] == '/' && ((loc[2] == '/' && loc[3] != '/') || loc[2] == '!')) ||
|
((loc[1] == '/' && ((loc[2] == '/' && loc[3] != '/') || loc[2] == '!')) ||
|
||||||
(loc[1] == '*' && ((loc[2] == '*' && loc[3] != '*') || loc[2] == '!')))) {
|
(loc[1] == '*' && ((loc[2] == '*' && loc[3] != '*' && loc[3] != '/') || loc[2] == '!')))) {
|
||||||
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST : DOX_COMMENT_PRE;
|
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST : DOX_COMMENT_PRE;
|
||||||
if (existing_comment != DOX_COMMENT_NONE && this_comment != existing_comment) {
|
if (existing_comment != DOX_COMMENT_NONE && this_comment != existing_comment) {
|
||||||
/* We can't concatenate together Doxygen pre- and post-comments. */
|
/* We can't concatenate together Doxygen pre- and post-comments. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue