Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with Segmentation fault in ClassDefImpl::mergeMembers #9229

Closed
wfjm opened this issue Mar 26, 2022 · 6 comments
Closed

Crash with Segmentation fault in ClassDefImpl::mergeMembers #9229

wfjm opened this issue Mar 26, 2022 · 6 comments
Labels
bug VHDL VHDL / Verilog

Comments

@wfjm
Copy link

wfjm commented Mar 26, 2022

Describe the bug
The creation of the VHDL documentation of the w11 project crashes for 1.9.2 and 1.9.3 with

.....
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Segmentation fault (core dumped)

More details are described under Stack Trace.

Expected behavior
Works fine with 1.9.1 and previous versions

To Reproduce
The VHDL source tree is in w11 project.
The Doxyfile is attached.
A full reproducer script can be provided upon request.

Version
Using Ubuntu 2020.04 LTS. Both 1.9.2 and 1.9.3 crash. 1.9.1 works.

Stack trace
I've build 1.9.2 with debug

git checkout tags/Release_1_9_2
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" ..

and got the backtrace

#0  0x0000557d3ad3d390 in ClassDefImpl::mergeMembers (this=0x557d521fd100)
      at /mnt/data/opt/github/doxygen/src/classdef.cpp:3441
#1  0x0000557d3a7cd61c in buildCompleteMemberLists ()
      at /mnt/data/opt/github/doxygen/src/doxygen.cpp:7772
#2  0x0000557d3a7e4b8c in parseInput ()
      at /mnt/data/opt/github/doxygen/src/doxygen.cpp:11739
#3  0x0000557d3a79c5b1 in main (argc=2, argv=0x7ffd7a959578)
      at /mnt/data/opt/github/doxygen/src/main.cpp:37

The code around classdef.cpp:3441 is

    3439        const ClassDef *dstCd = dstMd->getClassDef();
    3440        /...
    3441        if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE))

An info locals gives

dstCd = 0x0
srcCd = 0x557d50f138f8

The problems is that

  • srcCd is not equal dstCd
  • that's why dstCd->isBaseClass(srcCd,TRUE) is executed
  • dstCd is nullptr --> Segmentation fault

Additional context
The Doxyfile (with .txt suffix added) and the output of info local are attached.
w11_vhd_all.Doxyfile.txt
doxy_crash_info_local.txt

@albert-github albert-github added bug VHDL VHDL / Verilog labels Mar 26, 2022
@albert-github
Copy link
Collaborator

Thanks for the report, a crash is a bad thing.

This is indeed a bug, you found it in the 1.9.2 and 1.9.3 version, pity that your debug is against the 1.9.2 version would be much better to have it against the current master (though I quickly don't see any relevant changes between 1.9.2 and the current master in that neighborhood).

Most likely cause is that something is not set in the vhdl parser and that other parsers do set it. But to investigate we need a small case.

I can confirm that it still crashes with the current master version after downloading the mentioned repository (tested quickly under Windows).

@albert-github
Copy link
Collaborator

A git bisect gave me:

3d4f0313d20cc8f71ade094faa006a2171ff29c2 is the first bad commit
commit 3d4f0313d20cc8f71ade094faa006a2171ff29c2
Date:   Tue Mar 2 21:40:36 2021 +0100

    Refactoring: replaced std::regex with own much faster implementation

@doxygen how to proceed?

albert-github added a commit to albert-github/doxygen that referenced this issue Mar 28, 2022
…geMembers

Incorrect translation of regular expression:
```
  static const std::regex reg("[[:space:]:|]",std::regex::optimize);
```
to
```
  static const reg::Ex reg(R"([\s|])");
```
this should have been:
```
  static const reg::Ex reg(R"([\s:|])");
```
@albert-github
Copy link
Collaborator

I've just pushed a proposed patch, pull request #9233

doxygen added a commit that referenced this issue Apr 1, 2022
issue #9229 Crash with Segmentation fault in ClassDefImpl::mergeMembers
@albert-github albert-github added the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label Apr 1, 2022
@albert-github
Copy link
Collaborator

Code has been integrated in master on GitHub (please don't close the issue as this will be done at the moment of an official release).

@wfjm
Copy link
Author

wfjm commented Apr 3, 2022

@Mitumaru: This issue is understood, corrected, and the fix will be released. So what's the point of doubling this issue ?

@doxygen
Copy link
Owner

doxygen commented May 5, 2022

This issue was previously marked 'fixed but not released',
which means it should be fixed in doxygen version 1.9.4.
Please verify if this is indeed the case. Reopen the
issue if you think it is not fixed and please include any additional information
that you think can be relevant (preferably in the form of a self-contained example).

@doxygen doxygen removed the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label May 5, 2022
@doxygen doxygen closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug VHDL VHDL / Verilog
Projects
None yet
Development

No branches or pull requests

3 participants