Skip to content

Commit

Permalink
Fix potential crash when reading tag file which contained nested java…
Browse files Browse the repository at this point in the history
… classes using generics

Also fixed a parse error when reading a tag file with a Java-style enum
  • Loading branch information
Dimitri van Heesch committed Aug 26, 2014
1 parent 745955f commit 6d4044a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/doxygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,16 @@ static Definition *buildScopeFromQualifiedName(const QCString name,
else // scope is a namespace
{
}
// make the parent/child scope relation
prevScope->addInnerCompound(innerScope);
innerScope->setOuterScope(prevScope);
if (innerScope)
{
// make the parent/child scope relation
prevScope->addInnerCompound(innerScope);
innerScope->setOuterScope(prevScope);
}
else // current scope is a class, so return only the namespace part...
{
return prevScope;
}
// proceed to the next scope fragment
p=idx+l+2;
prevScope=innerScope;
Expand Down
9 changes: 8 additions & 1 deletion src/tagreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class TagMemberInfo
class TagClassInfo
{
public:
enum Kind { Class, Struct, Union, Interface, Exception, Protocol, Category };
enum Kind { Class, Struct, Union, Interface, Exception, Protocol, Category, Enum };
TagClassInfo() { bases=0, templateArguments=0; members.setAutoDelete(TRUE); isObjC=FALSE; }
~TagClassInfo() { delete bases; delete templateArguments; }
QCString name;
Expand Down Expand Up @@ -301,6 +301,12 @@ class TagFileParser : public QXmlDefaultHandler
m_curClass->kind = TagClassInfo::Interface;
m_state = InClass;
}
else if (kind=="enum")
{
m_curClass = new TagClassInfo;
m_curClass->kind = TagClassInfo::Enum;
m_state = InClass;
}
else if (kind=="exception")
{
m_curClass = new TagClassInfo;
Expand Down Expand Up @@ -1286,6 +1292,7 @@ void TagFileParser::buildLists(Entry *root)
case TagClassInfo::Struct: ce->spec = Entry::Struct; break;
case TagClassInfo::Union: ce->spec = Entry::Union; break;
case TagClassInfo::Interface: ce->spec = Entry::Interface; break;
case TagClassInfo::Enum: ce->spec = Entry::Enum; break;
case TagClassInfo::Exception: ce->spec = Entry::Exception; break;
case TagClassInfo::Protocol: ce->spec = Entry::Protocol; break;
case TagClassInfo::Category: ce->spec = Entry::Category; break;
Expand Down

0 comments on commit 6d4044a

Please sign in to comment.