Fix a bunch of crashes discovered by fuzzing cppfront#1383
Merged
hsutter merged 8 commits intohsutter:mainfrom Apr 29, 2025
Merged
Fix a bunch of crashes discovered by fuzzing cppfront#1383hsutter merged 8 commits intohsutter:mainfrom
hsutter merged 8 commits intohsutter:mainfrom
Conversation
`exit(1)` -> `exit(EXIT_FAILURE)`
Branch and loop bodies are always enclosed in `{` `}` even when they contain a single line
Owner
|
Thanks! This is a nice set of fixed, appreciated. Fuzzing FTW 🏅 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.