[compiler-rt] [compiler-rt][asan] intercept bsd's strtoq. (PR #78097)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 14 06:21:34 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 59e79f0de59d9e4576b6bf562de40a914702efd4 ab7b2ddcd79154eead429fef7b2afad1f40eaf97 -- compiler-rt/test/asan/TestCases/FreeBSD/strtoq_strict.c compiler-rt/lib/asan/asan_interceptors.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/test/asan/TestCases/FreeBSD/strtoq_strict.c b/compiler-rt/test/asan/TestCases/FreeBSD/strtoq_strict.c
index 0890225b7b..d96679bc15 100644
--- a/compiler-rt/test/asan/TestCases/FreeBSD/strtoq_strict.c
+++ b/compiler-rt/test/asan/TestCases/FreeBSD/strtoq_strict.c
@@ -23,9 +23,9 @@
 // RUN: %env_asan_opts=strict_string_checks=true not %run %t test7 2>&1 | FileCheck %s --check-prefix=CHECK7
 
 #include <assert.h>
+#include <sanitizer/asan_interface.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sanitizer/asan_interface.h>
 
 #if __LP64__
 typedef long long quad_t;
@@ -89,32 +89,40 @@ void test7(char *array, char *endptr) {
 }
 
 int main(int argc, char **argv) {
-  char *array0 = (char*)malloc(11);
-  char* array = array0 + 8;
+  char *array0 = (char *)malloc(11);
+  char *array = array0 + 8;
   char *endptr = NULL;
   array[0] = '1';
   array[1] = '2';
   array[2] = '3';
-  if (argc != 2) return 1;
-  if (!strcmp(argv[1], "test1")) test1(array, endptr);
+  if (argc != 2)
+    return 1;
+  if (!strcmp(argv[1], "test1"))
+    test1(array, endptr);
   // CHECK1: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK1: READ of size 4
-  if (!strcmp(argv[1], "test2")) test2(array, endptr);
+  if (!strcmp(argv[1], "test2"))
+    test2(array, endptr);
   // CHECK2: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK2: READ of size 4
-  if (!strcmp(argv[1], "test3")) test3(array0, endptr);
+  if (!strcmp(argv[1], "test3"))
+    test3(array0, endptr);
   // CHECK3: {{.*ERROR: AddressSanitizer: use-after-poison on address}}
   // CHECK3: READ of size 1
-  if (!strcmp(argv[1], "test4")) test4(array, endptr);
+  if (!strcmp(argv[1], "test4"))
+    test4(array, endptr);
   // CHECK4: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK4: READ of size 1
-  if (!strcmp(argv[1], "test5")) test5(array, endptr);
+  if (!strcmp(argv[1], "test5"))
+    test5(array, endptr);
   // CHECK5: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK5: READ of size 4
-  if (!strcmp(argv[1], "test6")) test6(array, endptr);
+  if (!strcmp(argv[1], "test6"))
+    test6(array, endptr);
   // CHECK6: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK6: READ of size 4
-  if (!strcmp(argv[1], "test7")) test7(array, endptr);
+  if (!strcmp(argv[1], "test7"))
+    test7(array, endptr);
   // CHECK7: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
   // CHECK7: READ of size 2
   free(array0);

``````````

</details>


https://github.com/llvm/llvm-project/pull/78097


More information about the llvm-commits mailing list