[compiler-rt] [ASan] Change strdup interceptor to allow null input on Windows (PR #122803)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 08:21:03 PST 2025


================
@@ -0,0 +1,16 @@
+// RUN: %clang_cl_asan %s -Fe%t.exe
+// RUN: %run %t.exe | FileCheck %s
+
+// CHECK: Success
+
+#include <malloc.h>
+#include <stdio.h>
+#include <string.h>
+
+int main() {
+  // Null input is valid to strdup on Windows.
+  char *nullStr = _strdup(nullptr);
+  free(nullStr);
+  puts("Success");
+  return 0;
+}
----------------
fmayer wrote:

nit: missing EOL

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


More information about the llvm-commits mailing list