mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[BitCode] Don't allow constants of void type.
llvm-svn: 271848
This commit is contained in:
parent
bfcbd10626
commit
cb52965257
@ -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
|
||||
|
BIN
test/Bitcode/Inputs/invalid-void-constant.bc
Normal file
BIN
test/Bitcode/Inputs/invalid-void-constant.bc
Normal file
Binary file not shown.
@ -212,3 +212,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-name-with-0-byte.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=NAME-WITH-0 %s
|
||||
|
||||
NAME-WITH-0: Invalid value name
|
||||
|
||||
RUN: not llvm-dis -disable-output %p/Inputs/invalid-void-constant.bc 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=VOID-CONSTANT-TYPE %s
|
||||
|
||||
VOID-CONSTANT-TYPE: Invalid constant type
|
||||
|
Loading…
Reference in New Issue
Block a user