tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Segfault with doxygen and patches/patch-src_dirdef.cpp



Hi,

I'm experiencing repeatable segfaults with doxygen (both 1.17.0 from
2026Q2 and 1.11.0 from 2024Q2) in some external and complex
package. On other systems than NetBSD I don't see that issue with the
same package and various doxygen versions.

I could not manage to create a small reproducer that I could easily
share here, however:
* the segfault happens only with DIRECTORY_GRAPH=YES
* It fails in writePartialDirPath(), src/dirdef.cpp:956 by
  dereferencing a NULL `target' pointer (passed recursively via
  target->parent(). Looking at the code it does not seem expected that
  target->parent() can be NULL.

#0  writePartialDirPath (ol=..., root=0x7f7ff65c7080, target=0x0)
    at /usr/pkgsrc/devel/doxygen/work/doxygen-1.17.0/src/dirdef.cpp:956
#1  0x0000000000533ff7 in writePartialDirPath (ol=..., root=<optimized out>,
    target=0x7f7ff65c6b80)
    at /usr/pkgsrc/devel/doxygen/work/doxygen-1.17.0/src/dirdef.cpp:958
#2  0x0000000000533ff7 in writePartialDirPath (ol=..., root=<optimized out>,
    target=0x7f7ff65c6cc0)
    at /usr/pkgsrc/devel/doxygen/work/doxygen-1.17.0/src/dirdef.cpp:958
etc...
#7  0x0000000000536eaf in DirRelation::writeDocumentation (
    this=<optimized out>, ol=...)
    at /usr/pkgsrc/devel/doxygen/work/doxygen-1.17.0/src/dirdef.cpp:1023
#8  0x0000000000537470 in generateDirDocs (ol=...)
    at /usr/include/g++/bits/unique_ptr.h:198
#9  0x0000000000150bb5 in generateOutput() ()
#10 0x000000000071834f in main ()

and dirdef.cpp:
956       if (target->parent()!=root)
957       {
958         writePartialDirPath(ol,root,target->parent());

However, since there is patches/patch-src_dirdef.cpp I tried to remove
it and this happens to fix the segfault. I've no idea why, but the
patch seems somehow problematic.

Before trying to dig into this, I was wondering if patch-src_dirdef.cpp
is still useful or relevant? From the comment it says that it will
prevent some WRKDIR paths from appearing in the generated doc, but
from what I understand, this:

-  QCString dir = "dir_"+encodeDirName(m_diskName);
+  QCString dir = "dir_"+encodeDirName(m_shortName);

does just change the source for encodeDirName, and no path will ever
appear in the result since encodeDirName returns a MD5 hash of the path.

It seems that commented out code mentionning 'old algorithm'
(dirref.cpp:203) indicates that earlier doxygen version would just
escape the path, so then patch-src_dirdef.cpp would make sense.
But nowadays, I would just drop it.

Or did I miss something?


Home | Main Index | Thread Index | Old Index