diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-02 12:03:41 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-02 12:03:41 (GMT) |
commit | c83db38ea83499be19d9ff242bfa22ae534ee80c (patch) | |
tree | 3cda7e340f6946d802cc41c2d7fc15307ded9e5c /src | |
parent | a31c9fffec6b5145ac8509d77da826d2e196ed1e (diff) | |
download | Doxygen-c83db38ea83499be19d9ff242bfa22ae534ee80c.zip Doxygen-c83db38ea83499be19d9ff242bfa22ae534ee80c.tar.gz Doxygen-c83db38ea83499be19d9ff242bfa22ae534ee80c.tar.bz2 |
Debian Bug 762272: segfault with cyclic subgroups
Diffstat (limited to 'src')
-rw-r--r-- | src/groupdef.cpp | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 9160538..65e59f3 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -510,7 +510,31 @@ void GroupDef::removeMember(MemberDef *md) bool GroupDef::containsGroup(const GroupDef *def) { - return this==def || groupList->find(def) >= 0; + if (this==def) + { + return TRUE; + } + else if (groupList->find(def)>=0) + { + return TRUE; + } + else // look for subgroups as well + { + GroupList *groups = partOfGroups(); + if (groups) + { + GroupListIterator it(*groups); + GroupDef *gd; + for (;(gd=it.current());++it) + { + if (gd->containsGroup(def)) + { + return TRUE; + } + } + } + } + return FALSE; } void GroupDef::addGroup(const GroupDef *def) @@ -1346,16 +1370,23 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup) for (;(g=gli.current());++gli) { GroupDef *gd=0; - if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname)) && - !gd->containsGroup(subGroup) ) - { - gd->addGroup(subGroup); - subGroup->makePartOfGroup(gd); - } - else if (gd==subGroup) + if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { - warn(root->fileName,root->startLine,"Trying to add group %s to itself!", - gd->name().data()); + if (gd==subGroup) + { + warn(root->fileName,root->startLine,"Refusing to add group %s to itself", + gd->name().data()); + } + else if (gd->containsGroup(subGroup)) + { + warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a " + "subgroup of the former\n", subGroup->name().data(),gd->name().data()); + } + else + { + gd->addGroup(subGroup); + subGroup->makePartOfGroup(gd); + } } } } |