mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
[BitCode] Don't allow constants of void type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2868,6 +2868,7 @@ std::error_code BitcodeReader::parseConstants() {
|
||||
|
||||
// Read a record.
|
||||
Record.clear();
|
||||
Type *VoidType = Type::getVoidTy(Context);
|
||||
Value *V = nullptr;
|
||||
unsigned BitCode = Stream.readRecord(Entry.ID, Record);
|
||||
switch (BitCode) {
|
||||
@@ -2880,6 +2881,8 @@ std::error_code BitcodeReader::parseConstants() {
|
||||
return error("Invalid record");
|
||||
if (Record[0] >= TypeList.size() || !TypeList[Record[0]])
|
||||
return error("Invalid record");
|
||||
if (TypeList[Record[0]] == VoidType)
|
||||
return error("Invalid constant type");
|
||||
CurTy = TypeList[Record[0]];
|
||||
continue; // Skip the ValueList manipulation.
|
||||
case bitc::CST_CODE_NULL: // NULL
|
||||
|
||||
Reference in New Issue
Block a user