This is an archive of the discontinued LLVM Phabricator instance.

[ASTReader] Report error when accessing corrupt record data
AbandonedPublic

Authored by vsk on Feb 16 2016, 11:02 AM.

Details

Summary

If we try to read a corrupt pch, we can easily assert-fail or trigger invalid
memory accesses when manipulating ASTReader::RecordData objects. This problem
is easy enough to diagnose when assertions are enabled, but can cause trouble
otherwise.

Emit an error diagnostic when we detect a bad RecordData access.

Diff Detail

Event Timeline

vsk updated this revision to Diff 48086.Feb 16 2016, 11:02 AM
vsk retitled this revision from to [ASTReader] Report error when accessing corrupt record data.
vsk updated this object.
vsk added reviewers: rsmith, benlangmuir.
vsk added a subscriber: cfe-commits.
vsk added a comment.Mar 2 2016, 10:35 AM

Gentle ping.

For context, we've had a few situations where corrupt pch files trigger surprising assertion failures in our world builds.

benlangmuir edited edge metadata.Mar 2 2016, 10:55 AM

This LGTM, but I would like Richard to take a look too.

rsmith edited edge metadata.Mar 18 2016, 10:51 AM

Have you done any performance testing on this code? In modules-heavy builds, bitcode reading is *very* hot.

vsk abandoned this revision.May 10 2016, 11:18 AM

I haven't measured the performance overhead of this patch. The failure case it's supposed to protect against is exceptionally rare: we haven't seen it happen again. In light of that, and considering that it clutters up the code, I think it'd be better to drop this.