Skip to content

Fix a bunch of crashes discovered by fuzzing cppfront #1383

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

Merged
merged 8 commits into from
Apr 29, 2025

Conversation

threeifbyair
Copy link
Contributor

@threeifbyair threeifbyair commented Mar 30, 2025

Here are fixes for several cppfront crashes discovered from fuzzing.

(1) Errors found in metafunctions cause cppfront to end with a signal instead of exiting cleanly.
(2) Two #else operations cause an assertion instead of an error.
(3) $ is allowed in preconditions and assertions but crashes cppfront when it tries to emit cpp1.
(4) 'unsigned char' close to the end of the file causes an assertion.
(5) Comments near the end of the file cause an assertion.
(6) If the initializer of a parameter is not an expression, cppfront segfaults.
(7) If a type defines a function before stating a superclass, cppfront crashes. (Closes #1382)
(8) Some invalid aliases crash cppfront.
(9) 'decltype' in the wrong place crashes cppfront.

Of these, only (5) was found on legal C++2 code. The rest should have generated (and now do generate) errors.

@hsutter
Copy link
Owner

hsutter commented Apr 29, 2025

Thanks! This is a nice set of fixed, appreciated. Fuzzing FTW 🏅

@hsutter hsutter merged commit b43cae6 into hsutter:main Apr 29, 2025
22 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Method followed by inheritance crashes cppfront
2 participants