================
@@ -6427,8 +6404,15 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
&CallInfo,
       getBundlesForFunclet(CalleePtr);
 
   if (SanOpts.has(SanitizerKind::KCFI) &&
-      !isa_and_nonnull<FunctionDecl>(TargetDecl))
+      !isa_and_nonnull<FunctionDecl>(TargetDecl)) {
     EmitKCFIOperandBundle(ConcreteCallee, BundleList);
+    // An indirect call through a function type without a prototype (e.g.
+    // pre-C23 `int (*)()`) isn't checked.
+    if (isa_and_nonnull<FunctionNoProtoType>(
+            ConcreteCallee.getAbstractInfo().getCalleeFunctionType()) &&
+        !isa<llvm::Constant>(CalleePtr->stripPointerCasts()))
----------------
efriedma-quic wrote:

Is stripPointerCasts doing anything useful here?

https://github.com/llvm/llvm-project/pull/243285
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to