-
Notifications
You must be signed in to change notification settings - Fork 50
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
Segmentation fault when "#pragma\n" is encountered #188
Comments
Thanks for reporting, I'll try to have a look. |
Thanks for the very clear bug report. It looks like the code that implements pragmas assumes there is always at least one token (the space) after It looks like there's a simple fix: testing for an empty token sequence and returning early. It may not be the best fix, but it should be a usable workaround. Add this at the start of
|
I think another possible fix would be to change this: wave/include/boost/wave/grammars/cpp_grammar.hpp Lines 541 to 550 in 61abf8b
to use + instead of * . This change would cause it to report an illformed preprocessor directive for the code above.
Also, I should go back to read the standard to see what it has to say about |
Well, here we go: https://eel.is/c++draft/cpp.pragma. My suggested fix is incorrect, then. A line with just a |
A fix for this has been merged into master and will be released as part of Boost 1.84 |
Thank you, @jefftrull! |
System info
Actual behaviour
Preprocessing C++ source code with a
#pragma
statement immediately followed by a newline (\n
) using Wave crashes the program with a segmentation fault.Expected behaviour
The preprocessor lets the
#pragma
statement through to the output as unrecognized. Or throw a recoverable error.Minimal reproducer
Minimal reproducer based on the "Quick start" section in the documentation:
The text was updated successfully, but these errors were encountered: