[compiler-rt] [compiler-rt][asan] _aligned_malloc/_aligned_free interception. (PR #82049)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 07:43:40 PST 2024


================
@@ -33,6 +33,14 @@ int test_function() {
     return __LINE__;
   _aligned_free(p);
 
+  char *y = (char *)malloc(1024);
+  char *u = (char *)realloc(y, 2048);
+  u[0] = 'a';
+  _aligned_free(u);
+  // CHECK: AddressSanitizer: attempting free on address which was not malloc()-ed: [[ADDR]] in thread T0
+  u = (char *)_aligned_offset_malloc(1024, 8, 2);
+  _aligned_free(u);
+
----------------
zmodem wrote:

Why did you move this from compiler-rt/test/asan/TestCases/Windows/aligned_mallocs.cpp ?

Also, we want `_aligned_offset_malloc` followed by `_aligned_free` to work, so CHECK'ing that it fails isn't a fix.

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


More information about the llvm-commits mailing list