summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp1
-rw-r--r--llvm/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bcbin0 -> 452 bytes
-rw-r--r--llvm/test/Bitcode/invalid.test5
3 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index c66b60681e5..4eda9d6c9ad 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5259,6 +5259,7 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
unsigned OpNum = 0;
Value *Val, *Ptr;
if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
+ !isa<PointerType>(Ptr->getType()) ||
(BitCode == bitc::FUNC_CODE_INST_STOREATOMIC
? getValueTypePair(Record, OpNum, NextValueNo, Val)
: popValue(Record, OpNum, NextValueNo,
diff --git a/llvm/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc b/llvm/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
new file mode 100644
index 00000000000..042fea51a59
--- /dev/null
+++ b/llvm/test/Bitcode/Inputs/invalid-nonpointer-storeatomic.bc
Binary files differ
diff --git a/llvm/test/Bitcode/invalid.test b/llvm/test/Bitcode/invalid.test
index 321c7a9fc77..2c2ae8f326a 100644
--- a/llvm/test/Bitcode/invalid.test
+++ b/llvm/test/Bitcode/invalid.test
@@ -222,3 +222,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-gep-no-operands.bc 2>&1 | \
RUN: FileCheck --check-prefix=GEP-NO-OPERANDS %s
GEP-NO-OPERANDS: Invalid gep with no operands
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>&1 | \
+RUN: FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s
+
+NONPOINTER-STOREATOMIC: Invalid record
OpenPOWER on IntegriCloud