Inspired by the discussion on D118694, this adds a straightforward fuzzer for bitcode reading.
Details
Diff Detail
Unit Tests
Event Timeline
After fixing some issues in the bitstream reader to report errors using the right mechanism, this now quickly runs into OOM, because we do unconditional vector reservations. Can be fixed (a standard approach is to reject reservations larger than the input size for example), just not sure if making bitcode parsing more resilient is something I should invest time in.
If we check this in, does it start failing buildbots or anything if it's not clean? Do we have to address the OOMs for this to be clean, or are OOMs not considered failures by any buildbots/don't produce failmail?
Nothing should use the fuzzer by default, it needs to be added to oss-fuzz to run. So just adding it is not problematic.
Hmm, seems unfortunate to checkin dead code, though? But I guess if this is the normal way fuzzers are added/adopted/eventually integrated into oss-fuzz, fair enough.
Landed as https://github.com/llvm/llvm-project/commit/82ef888fbf3a19c80b042c483fe939d93d187f1d, forgot to add the differential revision tag.
clang-format: please reformat the code