Re: segfault in addVariableToFile() in doxygen-1.4.6

Dimitri van Heesch <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
On 1/5/06, Michal Marek <[email protected]> wrote:
>
> Hi,
>
> we found a bug in doxygen-1.4.6, which causes it to segfault sometimes
> (I couldn't create a simple testcase though). In 1.4.6, the following
> code was added to doxygen.cpp:
>
> +        if (! // not a php array
> +            (md->getFileDef() &&
> getLanguageFromFileName(md->getFileDef()->name())==SrcLangExt_PHP) &&
> +            (md->argsString()!=root->args && root->args.find('[')!=-1)
> +           )
> +          // not a php array variable
> +        {
> ...
>
> however, this doesn't check the return value of md->getFileDef() (as it
> is done on other places). This seems to fix the segfault:
>
> --- src/doxygen.cpp
> +++ src/doxygen.cpp
> @@ -1912,7 +1912,7 @@
>          // variable already in the scope
>        {
>          if (! // not a php array
> -
> (getLanguageFromFileName(md->getFileDef()->name())==SrcLangExt_PHP) &&
> +            (md->getFileDef() &&
> getLanguageFromFileName(md->getFileDef()->name())==SrcLangExt_PHP) &&
>              (md->argsString()!=root->args && root->args.find('[')!=-1)
>             )
>            // not a php array variable
>
> Michal Marek
> SuSE CR



This is indeed a bug. It seems to be possible to trigger it when using tag
files and namespaces. Your patch will be included in the next CVS update.

Regards,
  Dimitri
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.