Skip to content

Commit

Permalink
[BitCode] Make sure atomicrmw'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@271851 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
filcab committed Jun 5, 2016
1 parent afe713a commit 98090ec
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 @@ -5340,6 +5340,7 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
unsigned OpNum = 0;
Value *Ptr, *Val;
if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
!isa<PointerType>(Ptr->getType()) ||
popValue(Record, OpNum, NextValueNo,
cast<PointerType>(Ptr->getType())->getElementType(), Val) ||
OpNum+4 != Record.size())
Expand Down
Binary file added test/Bitcode/Inputs/invalid-nonpointer-atomicrmw.bc
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 @@ -227,3 +227,8 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-storeatomic.bc 2>
RUN: FileCheck --check-prefix=NONPOINTER-STOREATOMIC %s

NONPOINTER-STOREATOMIC: Invalid record

RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 | \
RUN: FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s

NONPOINTER-ATOMICRMW: Invalid record

0 comments on commit 98090ec

Please sign in to comment.