segfault in addVariableToFile() in doxygen-1.4.6

Michal Marek <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
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 SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
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.