[compiler-rt] [HWASAN] Add test to detected use after free in memcmp (PR #67204)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 16:07:14 PDT 2023
================
@@ -0,0 +1,15 @@
+// RUN: %clangxx -O0 %s -o %t && %run %t
+// XFAIL: *
+// UNSUPPORTED: lsan, ubsan
+// FIXME: HWASAN should work when we have intercepptors.
+// UNSUPPORTED: hwasan
+
+#include <cstring>
+#include <cstdio>
+
+int main(int argc, char** argv) {
+ int *x = new int(7);
+ delete x;
+ // Trigger use after free error.
+ return memcmp(x, &argc, sizeof(int)) == 0 ? 1 : 0;
+}
----------------
fmayer wrote:
Please add newline at EOF.
https://github.com/llvm/llvm-project/pull/67204
More information about the llvm-commits
mailing list