summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2015-03-11 06:57:30 +0000
committerOwen Anderson <resistor@mac.com>2015-03-11 06:57:30 +0000
commita3c68fdf82a6c9b9851c9c19935b9298928c9262 (patch)
treec2afa889278ab30fa4e8d198f3106bb9e309361d /llvm/lib/IR/Verifier.cpp
parentf9bde287e86551c90202c3fa3893d5db313dfbc1 (diff)
downloadbcm5719-llvm-a3c68fdf82a6c9b9851c9c19935b9298928c9262.tar.gz
bcm5719-llvm-a3c68fdf82a6c9b9851c9c19935b9298928c9262.zip
Fix another verifier crash where a GC intrinsic would look at the internals of another intrinsic in order to verify itself.
This causes a crash if the referenced intrinsic was malformed. In this case, we would already have reported an error on the referenced intrinsic, but then crashed on the second one when it tried to introspect the first without error checking. llvm-svn: 231910
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 10f934bedac..eaad5fb1b98 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2971,10 +2971,15 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
// section of the statepoint's argument
Assert(StatepointCS.arg_size() > 0,
"gc.statepoint: insufficient arguments");
+ Assert(isa<ConstantInt>(StatepointCS.getArgument(1)),
+ "gc.statement: number of call arguments must be constant integer");
const unsigned NumCallArgs =
cast<ConstantInt>(StatepointCS.getArgument(1))->getZExtValue();
Assert(StatepointCS.arg_size() > NumCallArgs+3,
"gc.statepoint: mismatch in number of call arguments");
+ Assert(isa<ConstantInt>(StatepointCS.getArgument(NumCallArgs+3)),
+ "gc.statepoint: number of deoptimization arguments must be "
+ "a constant integer");
const int NumDeoptArgs =
cast<ConstantInt>(StatepointCS.getArgument(NumCallArgs + 3))->getZExtValue();
const int GCParamArgsStart = NumCallArgs + NumDeoptArgs + 4;
OpenPOWER on IntegriCloud