Michal Marek | 5 Jan 14:34 2006
Picon

segfault in addVariableToFile() in doxygen-1.4.6

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
 <at>  <at>  -1912,7 +1912,7  <at>  <at> 
         // 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)
            )
(Continue reading)

Dimitri van Heesch | 6 Jan 12:10 2006
Picon

Re: segfault in addVariableToFile() in doxygen-1.4.6

On 1/5/06, Michal Marek <mmarek <at> suse.cz> 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
<at> <at> -1912,7 +1912,7 <at> <at>
         // 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

Torsten Ihben | 10 Jan 12:54 2006
Picon

HTML link incorrect when using tagfile

Hi there!

I'm new to this mailing list, and I don't know if I'm corret here.

When I create a doxygen documentation and I reference to a different
documentation using a tag file the created link is not correct. Instead
of the correct form 'href="file:///c/..."' a link of the form
'href="c:\..."' is created. Using Internet Explorer this is just fine,
this browser corrects the link. But Firefox is not so forgiving; when I
click on this link I receive an error message that "c is not a
registered protocol".

I hope someone of you can help me with this problem.

Regards, Torsten

-------------------------------------------------------------------------------------------------------------------------------------------------- 
Visit ROSEN on the Internet: www.RosenInspection.net

-------------------------------------------------------
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_idv37&alloc_id865&op=click
detox | 14 Jan 14:14 2006
Picon

[PATCH] handling gcc attributes

The following patch allows doxygen to process C code which contains GCC 
attributes.
http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Attribute-Syntax.html#Attribute-Syntax

Symptom: Doxygen gets confused when trying to process C code that 
contains attributes, it usually throws off the parser causing 
everything from the start of the first attribute to the end of the file 
to be mis-processed.

Cause: The scanner doesn't know to look for attributes.

Index: doxygen-1.4.6/src/scanner.l
===================================================================
--- doxygen-1.4.6/src/scanner.l	2005-12-27 13:04:40.000000000 -0500
+++ doxygen-1.4.6-tlw/src/scanner.l	2006-01-14 07:51:22.210391347 -0500
 <at>  <at>  -1195,7 +1195,7  <at>  <at> 
 					  }
   					}
 <FindMembers>{B}*(("typedef"{BN}+)?)("volatile"{BN}+)?"struct{" | 
-<FindMembers>{B}*(("typedef"{BN}+)?)("volatile"{BN}+)?"struct"/{BN}+ { 
+<FindMembers>{B}*(("typedef"{BN}+)?)
("volatile"{BN}+)?"struct"({BN}+"__attribute__"{BN}*"((".*"))")?/{BN}+ 
{ 
 					  isTypedef=((QCString)yytext).find("typedef")!=-1;
   					  current->section = Entry::STRUCT_SEC ;
 					  addType( current ) ;
 <at>  <at>  -1233,6 +1233,8  <at>  <at> 
 					  if (yytext[yyleng-1]=='{') unput('{');
 					  BEGIN( CompoundName ) ;
 					}
+<FindMembers>"__attribute__"{BN}+"((".*"))"{BN}+ {
+					}
 <Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"("  {  // 
A::operator()<int>(int arg)
   					  lineCount();
 					  current->name += "()";
 <at>  <at>  -1874,7 +1876,8  <at>  <at> 
 <FindMembers,FindFields,ReadInitializer>"//"([!/]?)
{B}*{CMD}"}".*|"/*"([!*]?){B}*{CMD}"}".*"*/"	{
   					  closeGroup(current,yyFileName,yyLineNr);
   					}
-<FindMembers>"="			{
+<FindMembers>"=" |
+<FindMember>({BN}+"__attribute__"{BN}*"((".*"))"{BN}+)?"=" {
   					  current->bodyLine = yyLineNr;
 					  lastInitializerContext = YY_START;
 					  initBracketCount=0;
 <at>  <at>  -2202,7 +2205,9  <at>  <at> 
 					    BEGIN( Array ) ;
 					  }
 					}
-<Array>"]"				{ current->args += *yytext ;
+<Array>"]" |
+<Array>"]"({BN}+"__attribute__"{BN}*"((".*"))")? {
+					  current->args += *yytext ;
 					  if (--squareCount<=0)
 	                                     BEGIN( FindMembers ) ;
 					}
 <at>  <at>  -2211,7 +2216,8  <at>  <at> 
 					}
 <Array>.				{ current->args += *yytext ; }
 <SkipSquare>"["				{ squareCount++; }
-<SkipSquare>"]"				{
+<SkipSquare>"]"	|
+<SkipSquare>"]"({BN}+"__attribute__"{BN}*"((".*"))")? {
   					  if (--squareCount<=0)
 					    BEGIN( lastSquareContext );
   					}
 <at>  <at>  -2238,7 +2244,7  <at>  <at> 
 <FindFields>{ID}			{
   					  current->name = yytext;
 					}
-<FindFields>"="				{
+<FindFields>({BN}*"__attribute__"{BN}*"((".*"))"{BN}*)?"=" {
   					  lastInitializerContext = YY_START;
 					  initBracketCount=0;
   					  BEGIN(ReadInitializer);
 <at>  <at>  -2443,7 +2449,7  <at>  <at> 
 					  unput(';');
 					  BEGIN( MemberSpec ) ;
   					}
-<MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part 
could be improved.
+<MemberSpec>([*&]*{BN}*)*{ID}
{BN}*("["[^\]\n]*"]")*({BN}*"__attribute__"{BN}*"((".*"))")? { // the 
[] part could be improved.
   					  lineCount();
   					  int i=0,l=yyleng,j;
 					  while (i<l && (!isId(yytext[i]))) i++;
 <at>  <at>  -2574,7 +2580,7  <at>  <at> 
 					    BEGIN( FindMembers );
 					  }
   					}
-<MemberSpec>"="				{ 
+<MemberSpec>({BN}*"__attribute__"{BN}*"((".*"))"{BN}*)?"=" { 
   					  lastInitializerContext=YY_START;
 					  initBracketCount=0;
   					  BEGIN(ReadInitializer);

-------------------------------------------------------
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
Kevin McBride | 14 Jan 18:04 2006

Re: [PATCH] handling gcc attributes

Hello,

It's a good thing that you are submitting patches to the developer list,
and we appreciate you submitting your patches.  However, we prefer all
bugs to be filed within the bugzilla, even if you have the patches to
fix the bugs.  Doing so makes it easier for us to add fixed bugs to the
ChangeLogs. :)

Thank you,

- KJM

detox <at> vtnet.ca wrote:
> The following patch allows doxygen to process C code which contains 
> GCC attributes. 
> http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Attribute-Syntax.html#Attribute-Syntax
> 
> Symptom: Doxygen gets confused when trying to process C code that 
> contains attributes, it usually throws off the parser causing 
> everything from the start of the first attribute to the end of the 
> file to be mis-processed.
> 
> Cause: The scanner doesn't know to look for attributes.
> 

-------------------------------------------------------
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
Dave Dodge | 15 Jan 02:55 2006
Picon

Re: [PATCH] handling gcc attributes

On Sat, Jan 14, 2006 at 08:14:12AM -0500, detox <at> vtnet.ca wrote:
> The following patch allows doxygen to process C code which contains GCC 
> attributes.

Just FYI, a workaround for this is to make attributes conditionally
disappear in the preprocessor.  I usually do that anyway since I want
to avoid tying code to gcc:

#if defined ( __GNUC__ )
#define FUNC_MALLOC() __attribute__((__malloc__))
#else
#define FUNC_MALLOC()
#endif

extern void * foo(int,int) FUNC_MALLOC();

Doxygen still doesn't like seeing that FUNC_MALLOC() there.  That's
fixed by telling the Doxygen config to remove it during preprocessing:

PREDEFINED = \
  "FUNC_MALLOC()="

                                                  -Dave Dodge

-------------------------------------------------------
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
detox | 15 Jan 04:07 2006
Picon

Re: [PATCH] handling gcc attributes

On Saturday 14 January 2006 20:55, Dave Dodge wrote:
> On Sat, Jan 14, 2006 at 08:14:12AM -0500, detox <at> vtnet.ca wrote:
> > The following patch allows doxygen to process C code which contains
> > GCC attributes.
>
> Just FYI, a workaround for this is to make attributes conditionally
> disappear in the preprocessor.  I usually do that anyway since I want
> to avoid tying code to gcc:

Thanks for the tip, Dave. I much prefer this solution over hacking in 
support for arbitrary compilers into doxygen.

-------------------------------------------------------
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