summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2016-09-20 23:10:31 +0000
committerMichael Kuperstein <mkuper@google.com>2016-09-20 23:10:31 +0000
commit79dcc274b4c5334389b629a75d915cf954995b15 (patch)
treea2d6fc93f59d78588451b95c5e078872cac6ae12 /llvm/lib
parent620c140a9b50b715296f2e1412834aac151bb440 (diff)
downloadbcm5719-llvm-79dcc274b4c5334389b629a75d915cf954995b15.tar.gz
bcm5719-llvm-79dcc274b4c5334389b629a75d915cf954995b15.zip
[InferAttributes] Don't access parameters that don't exist.
Check for the correct number of parameters before querying their type. This fixes PR30455. llvm-svn: 282038
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/TargetLibraryInfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 2a47390b4cb..98f23214c65 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -847,10 +847,10 @@ bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy,
case LibFunc::stat64:
case LibFunc::lstat64:
case LibFunc::statvfs64:
- return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy() &&
+ return (NumParams == 2 && FTy.getParamType(0)->isPointerTy() &&
FTy.getParamType(1)->isPointerTy());
case LibFunc::dunder_isoc99_sscanf:
- return (NumParams >= 1 && FTy.getParamType(0)->isPointerTy() &&
+ return (NumParams >= 2 && FTy.getParamType(0)->isPointerTy() &&
FTy.getParamType(1)->isPointerTy());
case LibFunc::fopen64:
return (NumParams == 2 && FTy.getReturnType()->isPointerTy() &&
OpenPOWER on IntegriCloud