Skip to content

Commit

Permalink
[BitCode] Make sure storeatomic's argument is an actual PointerType
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271850 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
filcab committed Jun 5, 2016
1 parent e8dd99a commit afe713a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions test/Bitcode/invalid.test
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit afe713a

Please sign in to comment.