[llvm-branch-commits] [compiler-rt] [hwasan] Distinguish overflow and underflow (PR #76131)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 21 00:00:42 PST 2023


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 4188dde7d33ee6ae3b4b41a6d68b40e4fa65743c 5f8b7ed89bd460d61509a89ffe8cd28f7ab7ed60 -- compiler-rt/lib/hwasan/hwasan_report.cpp compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
index c1c7d458b9..44643eef57 100644
--- a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
+++ b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
@@ -37,36 +37,36 @@ int main(int argc, char **argv) {
   }
 #endif
 
-// CHECK40: allocated heap chunk; size: 32 offset: 8
-// CHECK40: Cause: heap-buffer-overflow
-// CHECK40: is located 10 bytes after a 30-byte region
-//
-// CHECK80: allocated heap chunk; size: 32 offset: 16
-// CHECK80: Cause: heap-buffer-overflow
-// CHECK80: is located 50 bytes after a 30-byte region
-//
-// CHECKm30: Cause: heap-buffer-underflow
-// CHECKm30: is located 30 bytes before a 30-byte region
-//
-// CHECKMm30: is a large allocated heap chunk; size: 1003520 offset: -30
-// CHECKMm30: Cause: heap-buffer-underflow
-// CHECKMm30: is located 30 bytes before a 1000000-byte region
-//
-// CHECKM: is a large allocated heap chunk; size: 1003520 offset: 1000000
-// CHECKM: Cause: heap-buffer-overflow
-// CHECKM: is located 0 bytes after a 1000000-byte region
-//
-// CHECK31: tags: [[TAG:..]]/0e([[TAG]]) (ptr/mem)
-// CHECK31-NOT: Invalid access starting at offset
-// CHECK31: Cause: heap-buffer-overflow
-// CHECK31: is located 1 bytes after a 30-byte region
-// CHECK31: Memory tags around the buggy address
-// CHECK31: [0e]
-// CHECK31: Tags for short granules around the buggy address
-// CHECK31: {{\[}}[[TAG]]]
-//
-// CHECK20-NOT: Invalid access starting at offset
-// CHECK20: Cause: heap-buffer-overflow
-// CHECK20: is located 10 bytes after a 20-byte region [0x{{.*}}0,0x{{.*}}4)
+  // CHECK40: allocated heap chunk; size: 32 offset: 8
+  // CHECK40: Cause: heap-buffer-overflow
+  // CHECK40: is located 10 bytes after a 30-byte region
+  //
+  // CHECK80: allocated heap chunk; size: 32 offset: 16
+  // CHECK80: Cause: heap-buffer-overflow
+  // CHECK80: is located 50 bytes after a 30-byte region
+  //
+  // CHECKm30: Cause: heap-buffer-underflow
+  // CHECKm30: is located 30 bytes before a 30-byte region
+  //
+  // CHECKMm30: is a large allocated heap chunk; size: 1003520 offset: -30
+  // CHECKMm30: Cause: heap-buffer-underflow
+  // CHECKMm30: is located 30 bytes before a 1000000-byte region
+  //
+  // CHECKM: is a large allocated heap chunk; size: 1003520 offset: 1000000
+  // CHECKM: Cause: heap-buffer-overflow
+  // CHECKM: is located 0 bytes after a 1000000-byte region
+  //
+  // CHECK31: tags: [[TAG:..]]/0e([[TAG]]) (ptr/mem)
+  // CHECK31-NOT: Invalid access starting at offset
+  // CHECK31: Cause: heap-buffer-overflow
+  // CHECK31: is located 1 bytes after a 30-byte region
+  // CHECK31: Memory tags around the buggy address
+  // CHECK31: [0e]
+  // CHECK31: Tags for short granules around the buggy address
+  // CHECK31: {{\[}}[[TAG]]]
+  //
+  // CHECK20-NOT: Invalid access starting at offset
+  // CHECK20: Cause: heap-buffer-overflow
+  // CHECK20: is located 10 bytes after a 20-byte region [0x{{.*}}0,0x{{.*}}4)
   free(x);
 }

``````````

</details>


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


More information about the llvm-branch-commits mailing list