From a8b974648f9d8bacc43280653dc654c9120d05ca Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 30 Nov 2007 15:52:20 +0000 Subject: [PATCH] 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 --- lib/VMCore/Verifier.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index eb7c90f01cc..c3633ff97a1 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) {