Skip to content

Commit e58dcf1

Browse files
authored
[Clang] [NFC] Prevent null pointer dereference in Sema::InstantiateFunctionDefinition (#89801)
In the lambda function within clang::Sema::InstantiateFunctionDefinition, the return value of a function that may return null is now checked before dereferencing to avoid potential null pointer dereference issues which can lead to crashes or undefined behavior in the program.
1 parent 96b2e35 commit e58dcf1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5184,6 +5184,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
51845184

51855185
ParmVarDecl *Parm = Function->getParamDecl(0);
51865186
TypeSourceInfo *NewParmSI = IR.TransformType(Parm->getTypeSourceInfo());
5187+
assert(NewParmSI && "Type transformation failed.");
51875188
Parm->setType(NewParmSI->getType());
51885189
Parm->setTypeSourceInfo(NewParmSI);
51895190
};

0 commit comments

Comments
 (0)