Fix for a case found by fuzzing PR23057 (comment #33 https://llvm.org/bugs/show_bug.cgi?id=23057#c33). Diagnose and consume unexpected ::new and ::delete tokens to prevent infinite loop in parsing a member initializer list.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This isn't quite the right way to fix this issue.
lib/Parse/ParseDeclCXX.cpp | ||
---|---|---|
3206–3209 ↗ | (On Diff #44971) | This is the right place to fix the bug. We should not enter this codepath if the previous initializer was not valid, and should instead fall into the else below to skip the rest of the initializers. (Delete the else { so that MemInit is still in scope here, and don't enter this block if MemInit.isInvalid(). Please also suppress the err_expected_either diagnostic below in that case.) |
Comment Actions
Thank you for the review! Updated the patch: parser now skips the rest of the initializers if the previous one was invalid, added several checks to the test.
Comment Actions
I am going to ask @ABataev to commit this. Hope to get commit access soon (this is my 5th patch) :)