aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-30 15:52:20 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-30 15:52:20 +0000
commita8b974648f9d8bacc43280653dc654c9120d05ca (patch)
tree0b7091ef39c2d93bcad156bb559aac81288e3801
parent962e0750a545ccced983386c859e436d9afddd79 (diff)
Check that there are not more attributes than
function parameters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44452 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index eb7c90f01c..c3633ff97a 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -396,6 +396,10 @@ void Verifier::visitFunction(Function &F) {
bool SawSRet = false;
if (const ParamAttrsList *Attrs = F.getParamAttrs()) {
+ Assert1(Attrs->size() &&
+ Attrs->getParamIndex(Attrs->size()-1) <= FT->getNumParams(),
+ "Function has excess attributes!", &F);
+
bool SawNest = false;
for (unsigned Idx = 0; Idx <= FT->getNumParams(); ++Idx) {