cppfront
cppfront copied to clipboard
[FIX] Fix infinite loop while parsing of string literal when there is missing closing `"` character
trafficstars
Close https://github.com/hsutter/cppfront/issues/117
The current implementation is not handling the parsing of a string literal. When the string has no matching " sign the cppfront parse the string infinitely.
Example of problematic file:
P:"P
This fix adds a check if cppfront is on the end of the line and returns:
tests/smallest_example.cpp2...
smallest_example.cpp2(1,2): error: string literal "Px00" is missing its closing "
smallest_example.cpp2(1,3): error: a deduced type must have an = initializer (at '"Px00')
smallest_example.cpp2(1,1): error: unexpected text at end of Cpp2 code section (at 'P')
smallest_example.cpp2(1,0): error: parse failed for section starting here