Skip to content

Commit aa59c81

Browse files
committed
Merge branch 'Issue-1643'
* Issue-1643: Fix pydoc null pointer dereference with missing arg type
2 parents 19e7648 + f99eb00 commit aa59c81

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

Examples/test-suite/doxygen_basic_translate.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ double Atan2(double y, double x)
110110
/* Regression test for crash with empty comment: */
111111
/**/
112112

113+
/**
114+
* @brief Test variadic function
115+
* @param ... extra args
116+
*/
117+
void function8(...) {
118+
}
119+
120+
/**
121+
* @brief Test unnamed argument
122+
* @param baz Description of baz
123+
*/
124+
void function9(int) {
125+
}
126+
113127
/**
114128
* Comment at the end of file should be ignored.
115129
*/

Examples/test-suite/java/doxygen_basic_translate_runme.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ public static void main(String argv[])
8686
" @param x Horizontal coordinate.\n" +
8787
" @return Arc tangent of <code>y/x</code>.\n" +
8888
"");
89+
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function8()",
90+
" Test variadic function\n" +
91+
"");
92+
93+
wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function9(int)",
94+
" Test unnamed argument\n" +
95+
"");
8996

9097
// and ask the parser to check comments for us
9198
System.exit(CommentParser.check(wantedComments));

Examples/test-suite/python/doxygen_basic_translate_runme.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@
7070
:type a: :py:class:`Shape`
7171
:param a: Very strange param"""
7272
)
73+
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function8),
74+
"""\
75+
Test variadic function
76+
:param ...: extra args"""
77+
)
78+
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function9),
79+
"""\
80+
Test unnamed argument
81+
:param baz: Description of baz"""
82+
)
7383

7484
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2),
7585
"""\

Source/Doxygen/pydoc.cxx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,10 @@ std::string PyDocConverter::getParamType(std::string param) {
434434
ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
435435
for (Parm *p = plist; p; p = nextSibling(p)) {
436436
String *pname = Getattr(p, "name");
437-
if (Char(pname) != param)
438-
continue;
439-
440-
type = getPyDocType(p, pname);
441-
break;
437+
if (pname && Char(pname) == param) {
438+
type = getPyDocType(p, pname);
439+
break;
440+
}
442441
}
443442
Delete(plist);
444443
return type;

0 commit comments

Comments
 (0)