diff options
author | Filipe Cabecinhas <me@filcab.net> | 2016-06-05 18:43:17 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2016-06-05 18:43:17 +0000 |
commit | 2849b48fea5c2fd011c2ae40bf3f31b60bfb8ab4 (patch) | |
tree | 40062cea5602ff5a2ba73c15ca8157d949fc70ff /llvm/lib/Bitcode | |
parent | 3e45d7783547aae720da2dc1e2643a93cf5f45d3 (diff) | |
download | bcm5719-llvm-2849b48fea5c2fd011c2ae40bf3f31b60bfb8ab4.tar.gz bcm5719-llvm-2849b48fea5c2fd011c2ae40bf3f31b60bfb8ab4.zip |
[BitCode] Don't allow constants of void type.
llvm-svn: 271848
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 287be9b683a..91eb3f603f2 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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 |