David Rorex - 2008-10-10

Doxygen was segfaulting on some of my PHP files. I'm using doxygen 1.5.7.1 on linux, same problem with precompiled binaries or if I compile myself Using gdb I traced it to line 2394 of commentscan.l,

  if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments

The problem was that 'current' was NULL and thus crashing on a null pointer. To fix, I added this at like 2377, and it appears to work now:

  if (current == NULL) return FALSE;

Here is the backtrace from gdb for reference:

ing::data (this=0x74) at qcstring.h:197
No locals.
#1  0x0806e6c7 in QCString::isEmpty (this=0x74) at qcstring.h:326
No locals.
#2  0x08208c55 in parseCommentBlock (parser=0x9cdb168, curEntry=0x0, comment=@0x84f53c4, fileName=@0x84f5330, lineNr=11,
    isBrief=false, isAutoBriefOn=false, isInbody=true, prot=@0x84f53fc, position=@0xbfa44504, newEntryNeeded=@0xbfa44503)
    at commentscan.l:2394
No locals.
#3  0x0818556c in handleCommentBlock (doc=@0x84f53c4, brief=false) at scanner.l:5385
        position = 0
        needsEntry = false
        hideInBodyDocs = false
#4  0x0819cca7 in scanYYlex () at scanner.l:5120
        yy_current_state = 1639
        yy_cp = 0xb7bbc18f ""
        yy_bp = 0xb7bbc18d "*/"
        yy_act = 561
        typedefHidesStruct = false
        re = {rxstring = {static null = {static null = <same as static member of an already seen type>, d = 0x9cc4f60,
      static shared_null = 0x9cc4f60}, d = 0x9d5d918, static shared_null = 0x9cc4f60}, rxdata = 0x9d63c60, error = 0,
  cs = true, wc = false}
#5  0x0819ee8d in parseMain (
    fileName=0x9d789e8 "/data/vhosts/....com/httpdocs/intapi/src/cgi/services/MIME_mail.php",
    fileBuf=0x9d80b20 "<?php\n /* ", '-' <repeats 57 times>, "\n    MIME Class:\n    Allows creation of e-mail messages via the MIME Standard.\n    The class supports multiple attachments and presen"..., rt=0x9d4c920) at scanner.l:5630
        sec = 0
#6  0x0819ef9c in CLanguageScanner::parseInput (this=0x9cdb168,
    fileName=0x9d789e8 "/data/vhosts/....com/httpdocs/intapi/src/cgi/services/MIME_mail.php",
    fileBuf=0x9d80b20 "<?php\n /* ", '-' <repeats 57 times>, "\n    MIME Class:\n    Allows creation of e-mail messages via the MIME Standard.\n    The class supports multiple attachments and presen"..., root=0x9d4c920) at scanner.l:5731
No locals.