[BitcodeReader] Validate Strtab before accessing.
authorFlorian Hahn <flo@fhahn.com>
Tue, 22 Jun 2021 13:48:45 +0000 (14:48 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 22 Jun 2021 13:52:16 +0000 (14:52 +0100)
commit34cccdaed7e7952a9191231ffa62b1b22eac35c8
tree79ef62c684422646e1246c2f695df0bf39e787cc
parente638a290f7d0bb85dbf81ba34eaaeef8c8d1b42d
[BitcodeReader] Validate Strtab before accessing.

This fixes a crash with invalid bitcode files that have records
referencing names in Strtab, but Strtab is not present or the index is
out-of-bounds.

This fixes the following clusterfuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29895

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D95554
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/test/Bitcode/invalid-record-strtab.ll [new file with mode: 0644]
llvm/test/Bitcode/invalid-record-strtab.ll.bc [new file with mode: 0644]