This is an archive of the discontinued LLVM Phabricator instance.

[Bitcode reader] Fix a few assertions when reading invalid files
ClosedPublic

Authored by filcab on Feb 1 2015, 5:28 PM.

Details

Summary

When creating {insert,extract}value instructions from a BitcodeReader, we
weren't verifying the fields were valid.

Bugs found with afl-fuzz

Diff Detail

Event Timeline

filcab updated this revision to Diff 19121.Feb 1 2015, 5:28 PM
filcab retitled this revision from to [Bitcode reader] Fix a few assertions when reading invalid files.
filcab updated this object.
filcab edited the test plan for this revision. (Show Details)
filcab added a reviewer: rafael.
filcab added a subscriber: Unknown Object (MLST).
silvas added a subscriber: silvas.Feb 2 2015, 3:12 PM

are you ever planning on switching over to a more "diag" style interface like Rafael suggested? That would allow making these errors much more informative.

filcab added a comment.Feb 2 2015, 3:25 PM

For now I'm still making sure we don't assert on stuff.
We can eventually add the Diag-style error handling, but that'll end up
“just” transforming these fixes I'm doing, it won't change them, so I'm
continuing to go through my set of inputs that crash the reader.

These ones also end up using the error reporting that was already there, so
it's not like they're report_fatal_error() calls. They actually tell the
caller that there was an error and it can do something (but not that much)
about it.

I might end up starting doing the Diag-style patch soon, but it depends on
the other work I have to do. In the meantime I'll keep going over the crash
fixes, since most of those are small-ish patches. (Unless there are
objections to me doing it now)

Filipe
rafael accepted this revision.Feb 5 2015, 12:46 PM
rafael edited edge metadata.

I am all for having a separate patch just replacing the fatal errors with diag + error_code/ErrorOr. That way we get an independent test change showing the improvement.

This revision is now accepted and ready to land.Feb 5 2015, 12:46 PM
This revision was automatically updated to reflect the committed changes.