BitcodeReader: Allow METADATA_STRINGS to only have !""

Support parsing a METADATA_STRINGS record that only has a single piece
of metadata, !"".  Fixes a corner case in r264551.

llvm-svn: 264699
This commit is contained in:
Duncan P. N. Exon Smith
2016-03-29 05:25:17 +00:00
parent 3acdfeee11
commit bb7ce3b850
2 changed files with 8 additions and 1 deletions

View File

@@ -1899,7 +1899,7 @@ std::error_code BitcodeReader::parseMetadataStrings(ArrayRef<uint64_t> Record,
unsigned StringsOffset = Record[1];
if (!NumStrings)
return error("Invalid record: metadata strings with no strings");
if (StringsOffset >= Blob.size())
if (StringsOffset > Blob.size())
return error("Invalid record: metadata strings corrupt offset");
StringRef Lengths = Blob.slice(0, StringsOffset);