Fix pydoc null pointer dereference with missing arg type

Processing doxygen @param comments for a parameter whose name did not
appear in the function declaration would cause a segfault due to a
null pointer dereference.

Adding test cases for both variadic function (no specified arguments)
and @param comment that references an argument that is not named in
the function prototype.  Both of these cases previously segfaulted.
This commit is contained in:
John McFarland 2019-10-27 18:19:42 -05:00
commit f99eb0058b
4 changed files with 35 additions and 5 deletions

View file

@ -418,11 +418,10 @@ std::string PyDocConverter::getParamType(std::string param) {
ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
for (Parm *p = plist; p; p = nextSibling(p)) {
String *pname = Getattr(p, "name");
if (Char(pname) != param)
continue;
type = getPyDocType(p, pname);
break;
if (pname && Char(pname) == param) {
type = getPyDocType(p, pname);
break;
}
}
Delete(plist);
return type;