In Parser::ParseDirectDeclarator(...) in some cases ill-formed code can cause an annotation token to end up where it was not expected. The fix is to add a !Tok.isAnnotation() guard before attempting to access identifier info.
This fixes:
Paths
| Differential D158804
[Clang] Fix crash in Parser::ParseDirectDeclarator by adding check that token is not an annotation token ClosedPublic Authored by shafik on Aug 24 2023, 7:27 PM.
Details Summary In Parser::ParseDirectDeclarator(...) in some cases ill-formed code can cause an annotation token to end up where it was not expected. The fix is to add a !Tok.isAnnotation() guard before attempting to access identifier info. This fixes:
Diff Detail Event TimelineComment Actions I'm not well versed in the parser code, but the fix clearly avoids the assertion in getIdentifierInfo(), and both @aaron.ballman and @rjmccall indicated in the issue discussion that this fix is appropriate, so I will take the liberty of approving this. This revision is now accepted and ready to land.Sep 6 2023, 1:20 AM Closed by commit rG6eadc8f16e03: [Clang] Fix crash in Parser::ParseDirectDeclarator by adding check that token… (authored by shafik). · Explain WhySep 12 2023, 11:20 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 556590 clang/docs/ReleaseNotes.rst
clang/lib/Parse/ParseDecl.cpp
clang/test/Parser/gh64836.cpp
|