From: Sanjoy Das Date: Sun, 29 Nov 2015 23:15:43 +0000 (+0000) Subject: Fix out of bounds access in hasStructRetAttr X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4e6293afeb829a33137df86f5d58b010121bf8cd;p=oota-llvm.git Fix out of bounds access in hasStructRetAttr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254273 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/Instructions.h b/include/llvm/IR/Instructions.h index a5a48cb30b0..5119749ba73 100644 --- a/include/llvm/IR/Instructions.h +++ b/include/llvm/IR/Instructions.h @@ -1730,6 +1730,9 @@ public: /// \brief Determine if the call returns a structure through first /// pointer argument. bool hasStructRetAttr() const { + if (getNumArgOperands() == 0) + return false; + // Be friendly and also check the callee. return paramHasAttr(1, Attribute::StructRet); } @@ -3614,6 +3617,9 @@ public: /// \brief Determine if the call returns a structure through first /// pointer argument. bool hasStructRetAttr() const { + if (getNumArgOperands() == 0) + return false; + // Be friendly and also check the callee. return paramHasAttr(1, Attribute::StructRet); }