[analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (#83585)
Fixes #78810 Thanks for Snape3058 's comment --------- Co-authored-by: miaozhiyuan <miaozhiyuan@feysh.com>
This commit is contained in:
parent
d9d9301eec
commit
d4687fe7d1
@ -1409,7 +1409,7 @@ CallEventManager::getSimpleCall(const CallExpr *CE, ProgramStateRef State,
|
|||||||
if (const auto *OpCE = dyn_cast<CXXOperatorCallExpr>(CE)) {
|
if (const auto *OpCE = dyn_cast<CXXOperatorCallExpr>(CE)) {
|
||||||
const FunctionDecl *DirectCallee = OpCE->getDirectCallee();
|
const FunctionDecl *DirectCallee = OpCE->getDirectCallee();
|
||||||
if (const auto *MD = dyn_cast<CXXMethodDecl>(DirectCallee))
|
if (const auto *MD = dyn_cast<CXXMethodDecl>(DirectCallee))
|
||||||
if (MD->isInstance())
|
if (MD->isImplicitObjectMemberFunction())
|
||||||
return create<CXXMemberOperatorCall>(OpCE, State, LCtx, ElemRef);
|
return create<CXXMemberOperatorCall>(OpCE, State, LCtx, ElemRef);
|
||||||
|
|
||||||
} else if (CE->getCallee()->getType()->isBlockPointerType()) {
|
} else if (CE->getCallee()->getType()->isBlockPointerType()) {
|
||||||
|
@ -60,3 +60,14 @@ void top() {
|
|||||||
s.c();
|
s.c();
|
||||||
s.c(11);
|
s.c(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct S2 {
|
||||||
|
bool operator==(this auto, S2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
void use_deducing_this() {
|
||||||
|
int result = S2{} == S2{}; // no-crash
|
||||||
|
clang_analyzer_dump(result); // expected-warning {{1 S32b}}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user