llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Nat (flynow10)

<details>
<summary>Changes</summary>

Addresses issue #<!-- -->183501


---
Full diff: https://github.com/llvm/llvm-project/pull/183928.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaChecking.cpp (+3) 
- (modified) clang/test/Sema/builtin-allow-sanitize-check.c (+3) 


``````````diff
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 45dce52179f82..366c3033099dd 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3804,6 +3804,9 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, 
unsigned BuiltinID,
   }
 
   case Builtin::BI__builtin_allow_sanitize_check: {
+    if (checkArgCount(TheCall, 1))
+      return ExprError();
+
     Expr *Arg = TheCall->getArg(0);
     // Check if the argument is a string literal.
     const StringLiteral *SanitizerName =
diff --git a/clang/test/Sema/builtin-allow-sanitize-check.c 
b/clang/test/Sema/builtin-allow-sanitize-check.c
index 6e0e21a869461..a7d83c1833d84 100644
--- a/clang/test/Sema/builtin-allow-sanitize-check.c
+++ b/clang/test/Sema/builtin-allow-sanitize-check.c
@@ -9,6 +9,9 @@ void test_builtin_allow_sanitize_check() {
   // Test with unsupported sanitizer name.
   (void)__builtin_allow_sanitize_check("unsupported"); // expected-error 
{{invalid argument 'unsupported' to __builtin_allow_sanitize_check}}
 
+  // Test with invalid number of arguments
+  (void)__builtin_allow_sanitize_check(); // expected-error {{too few 
arguments to function call}}
+
   // Test with supported sanitizer names.
   (void)__builtin_allow_sanitize_check("address");
   (void)__builtin_allow_sanitize_check("thread");

``````````

</details>


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

Reply via email to