From 4e6293afeb829a33137df86f5d58b010121bf8cd Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Sun, 29 Nov 2015 23:15:43 +0000 Subject: [PATCH] Fix out of bounds access in hasStructRetAttr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254273 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Instructions.h | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.34.1