mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-09 09:01:25 +00:00
Validate the return type when checking if a function is malloc.
Fixes PR11426. Not sure if a test case with a "wrong" malloc would be useful. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8f5cd3539
commit
1db1c239fe
@ -48,10 +48,10 @@ static bool isMallocCall(const CallInst *CI) {
|
|||||||
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
|
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
|
||||||
// attribute will exist.
|
// attribute will exist.
|
||||||
FunctionType *FTy = Callee->getFunctionType();
|
FunctionType *FTy = Callee->getFunctionType();
|
||||||
if (FTy->getNumParams() != 1)
|
return FTy->getReturnType() == Type::getInt8PtrTy(FTy->getContext()) &&
|
||||||
return false;
|
FTy->getNumParams() == 1 &&
|
||||||
return FTy->getParamType(0)->isIntegerTy(32) ||
|
(FTy->getParamType(0)->isIntegerTy(32) ||
|
||||||
FTy->getParamType(0)->isIntegerTy(64);
|
FTy->getParamType(0)->isIntegerTy(64));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// extractMallocCall - Returns the corresponding CallInst if the instruction
|
/// extractMallocCall - Returns the corresponding CallInst if the instruction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user