Skip to content

Commit 7b7c85d

Browse files
committed
[Bitcode] Check type of alloca size argument
This must be an integer. This check is present in LLParser but not the BitcodeReader.
1 parent 6aa6ef7 commit 7b7c85d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5962,6 +5962,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
59625962
if (!Align)
59635963
Align = DL.getPrefTypeAlign(Ty);
59645964

5965+
if (!Size->getType()->isIntegerTy())
5966+
return error("alloca element count must have integer type");
5967+
59655968
AllocaInst *AI = new AllocaInst(Ty, AS, Size, *Align);
59665969
AI->setUsedWithInAlloca(InAlloca);
59675970
AI->setSwiftError(SwiftError);

0 commit comments

Comments
 (0)