[llvm-commits] [compiler-rt] r152594 - /compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc

Kostya Serebryany kcc at google.com
Mon Mar 12 18:04:06 PDT 2012


Author: kcc
Date: Mon Mar 12 20:04:06 2012
New Revision: 152594

URL: http://llvm.org/viewvc/llvm-project?rev=152594&view=rev
Log:
[asan] output test for memcmp

Added:
    compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc

Added: compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc?rev=152594&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc (added)
+++ compiler-rt/trunk/lib/asan/output_tests/memcmp_test.cc Mon Mar 12 20:04:06 2012
@@ -0,0 +1,8 @@
+#include <string.h>
+int main(int argc, char **argv) {
+  char a1[] = {argc, 2, 3, 4};
+  char a2[] = {1, 2*argc, 3, 4};
+// Check-Common: AddressSanitizer stack-buffer-overflow
+  int res = memcmp(a1, a2, 4 + argc);  // BOOM
+  return res;
+}





More information about the llvm-commits mailing list