This is an archive of the discontinued LLVM Phabricator instance.

PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid for-range expression
ClosedPublic

Authored by d.zobnin.bugzilla on Jan 27 2016, 7:11 AM.

Details

Summary

Fix the issue discovered by fuzzing (https://llvm.org/bugs/show_bug.cgi?id=23057#c18) by handling nullptr in Sema::ActOnCXXForRangeDecl and correct delayed typos in for-range expression before calling Sema::ActOnCXXForRangeStmt (fixes PR26288 as well).

Diff Detail

Event Timeline

d.zobnin.bugzilla retitled this revision from to PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid for-range expression.
d.zobnin.bugzilla updated this object.
d.zobnin.bugzilla added reviewers: kcc, rsmith.
d.zobnin.bugzilla added a subscriber: cfe-commits.
majnemer added inline comments.
lib/Parse/ParseStmt.cpp
1719–1724

Does this change effect all of the test cases you've added? If not, I think it would make sense to split this change out.

lib/Parse/ParseStmt.cpp
1719–1724

Yes, this change is needed in all added test cases.
Without this we will have an assertion failure in ~Sema():

assert(DelayedTypos.empty() && "Uncorrected typos!");
majnemer accepted this revision.Feb 2 2016, 8:33 AM
majnemer added a reviewer: majnemer.

LGTM

This revision is now accepted and ready to land.Feb 2 2016, 8:33 AM
This revision was automatically updated to reflect the committed changes.