[PATCH] D147037: [Clang][ICE] Corrected invalid invalid parameter index on some attributes with invalid indices applied to varargs functions

Samuel Maina via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 03:44:53 PDT 2023


samuelmaina created this revision.
Herald added a subscriber: arphaman.
Herald added a reviewer: aaron.ballman.
Herald added a project: All.
samuelmaina requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147037

Files:
  clang/lib/Sema/SemaDeclAttr.cpp


Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -3763,7 +3763,8 @@
   ParamIdx Idx;
   if (!checkFunctionOrMethodParameterIndex(S, D, AL, 1, IdxExpr, Idx))
     return;
-
+  if (Idx.getASTIndex() >= getFunctionOrMethodNumParams(D))
+    return;
   // Make sure the format string is really a string.
   QualType Ty = getFunctionOrMethodParamType(D, Idx.getASTIndex());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147037.508950.patch
Type: text/x-patch
Size: 504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230328/f632bf62/attachment.bin>


More information about the cfe-commits mailing list