diff options
author | Owen Anderson <resistor@mac.com> | 2015-03-10 05:58:21 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2015-03-10 05:58:21 +0000 |
commit | 3e7e67b5eda50ee13e60da4abd4ceb5bb9d4f65f (patch) | |
tree | 5c033789662d6d282dfc9f59531d01c806bf266b /llvm/lib/IR/Verifier.cpp | |
parent | da19af4f42a132f3f3fb82858fef7037c32e60ad (diff) | |
download | bcm5719-llvm-3e7e67b5eda50ee13e60da4abd4ceb5bb9d4f65f.tar.gz bcm5719-llvm-3e7e67b5eda50ee13e60da4abd4ceb5bb9d4f65f.zip |
Fix an issue in the verifier where we could try to read information out of a malformed statepoint intrinsic.
In this situation we would always have already flagged an error on the statepoint intrinsic,
but then we carry on to parse other, related GC intrinsics, and could end up crashing during that
verification when they try to access data from the malformed statepoint.
llvm-svn: 231759
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 06104d54cba..10f934bedac 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2969,8 +2969,12 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { // Check that BaseIndex and DerivedIndex fall within the 'gc parameters' // section of the statepoint's argument - const int NumCallArgs = + Assert(StatepointCS.arg_size() > 0, + "gc.statepoint: insufficient arguments"); + const unsigned NumCallArgs = cast<ConstantInt>(StatepointCS.getArgument(1))->getZExtValue(); + Assert(StatepointCS.arg_size() > NumCallArgs+3, + "gc.statepoint: mismatch in number of call arguments"); const int NumDeoptArgs = cast<ConstantInt>(StatepointCS.getArgument(NumCallArgs + 3))->getZExtValue(); const int GCParamArgsStart = NumCallArgs + NumDeoptArgs + 4; |