aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-12-11 12:45:22 +0100
committerNikita Popov <npopov@redhat.com>2023-12-11 12:48:34 +0100
commit7b7c85d156f327312e37a60c21a4a2093919c5e1 (patch)
tree1abbefe41d810954ce1eeb84fc8adbb5347e989f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent6aa6ef73ece0042953f25c4b198fdec4d6f9769d (diff)
downloadllvm-7b7c85d156f327312e37a60c21a4a2093919c5e1.zip
llvm-7b7c85d156f327312e37a60c21a4a2093919c5e1.tar.gz
llvm-7b7c85d156f327312e37a60c21a4a2093919c5e1.tar.bz2
[Bitcode] Check type of alloca size argument
This must be an integer. This check is present in LLParser but not the BitcodeReader.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 98c5e94..e345167 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5962,6 +5962,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
if (!Align)
Align = DL.getPrefTypeAlign(Ty);
+ if (!Size->getType()->isIntegerTy())
+ return error("alloca element count must have integer type");
+
AllocaInst *AI = new AllocaInst(Ty, AS, Size, *Align);
AI->setUsedWithInAlloca(InAlloca);
AI->setSwiftError(SwiftError);