Commit 6d4044ad authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Fix potential crash when reading tag file which contained nested java classes using generics

Also fixed a parse error when reading a tag file with a Java-style enum
parent 745955f5
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -1037,9 +1037,16 @@ static Definition *buildScopeFromQualifiedName(const QCString name,
    else // scope is a namespace
    else // scope is a namespace
    {
    {
    }
    }
    if (innerScope)
    {
      // make the parent/child scope relation
      // make the parent/child scope relation
      prevScope->addInnerCompound(innerScope);
      prevScope->addInnerCompound(innerScope);
      innerScope->setOuterScope(prevScope);
      innerScope->setOuterScope(prevScope);
    }
    else // current scope is a class, so return only the namespace part...
    {
      return prevScope;
    }
    // proceed to the next scope fragment
    // proceed to the next scope fragment
    p=idx+l+2;
    p=idx+l+2;
    prevScope=innerScope;
    prevScope=innerScope;
+8 −1
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ class TagMemberInfo
class TagClassInfo
class TagClassInfo
{
{
  public:
  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() { bases=0, templateArguments=0; members.setAutoDelete(TRUE); isObjC=FALSE; }
   ~TagClassInfo() { delete bases; delete templateArguments; }
   ~TagClassInfo() { delete bases; delete templateArguments; }
    QCString name;
    QCString name;
@@ -301,6 +301,12 @@ class TagFileParser : public QXmlDefaultHandler
        m_curClass->kind = TagClassInfo::Interface;
        m_curClass->kind = TagClassInfo::Interface;
        m_state = InClass;
        m_state = InClass;
      }
      }
      else if (kind=="enum")
      {
        m_curClass = new TagClassInfo;
        m_curClass->kind = TagClassInfo::Enum;
        m_state = InClass;
      }
      else if (kind=="exception")
      else if (kind=="exception")
      {
      {
        m_curClass = new TagClassInfo;
        m_curClass = new TagClassInfo;
@@ -1286,6 +1292,7 @@ void TagFileParser::buildLists(Entry *root)
      case TagClassInfo::Struct:    ce->spec = Entry::Struct;    break;
      case TagClassInfo::Struct:    ce->spec = Entry::Struct;    break;
      case TagClassInfo::Union:     ce->spec = Entry::Union;     break;
      case TagClassInfo::Union:     ce->spec = Entry::Union;     break;
      case TagClassInfo::Interface: ce->spec = Entry::Interface; 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::Exception: ce->spec = Entry::Exception; break;
      case TagClassInfo::Protocol:  ce->spec = Entry::Protocol;  break;
      case TagClassInfo::Protocol:  ce->spec = Entry::Protocol;  break;
      case TagClassInfo::Category:  ce->spec = Entry::Category;  break;
      case TagClassInfo::Category:  ce->spec = Entry::Category;  break;