This is an archive of the discontinued LLVM Phabricator instance.

Fix two bugs in TGParser::ParseValue
ClosedPublic

Authored by Paul-C-Anagnostopoulos on Aug 12 2020, 12:51 PM.

Details

Summary

TGParser::ParseValue contains two recursive calls, one to parse the RHS of a list paste operator and one to parse the RHS of a paste operator in a class/def name. Both of these calls neglect to check the return value to see if it is null (because of some error). This causes a crash in the next line of code, which uses the return value. The code now checks for null returns.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2020, 12:51 PM
Paul-C-Anagnostopoulos requested review of this revision.Aug 12 2020, 12:51 PM

Do I need to reformat the code as Lint suggests? Most of the if (!xxx) return ... tests in the code are on one line.

Do I need to reformat the code as Lint suggests? Most of the if (!xxx) return ... tests in the code are on one line.

Yes, please do. Those single-line checks are increasingly rare in the LLVM code base for IMHO good reasons, let's not add new ones even if this code happens to be fairly old and not follow newer customs.

The change LGTM apart from that, thanks!

Reformatted the two lines of code correctly.

@nhaehnle, could you do me the favor of committing this?

This revision was not accepted when it landed; it landed in state Needs Review.Aug 21 2020, 2:20 PM
This revision was automatically updated to reflect the committed changes.

Hmm, forgot to adjust the author field to you for that commit. Sorry about that, I'm doing it for the other ones.