[compiler-rt] r246096 - Handle suppression files ending in CRLF (\r\n)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 15:23:50 PDT 2015
Author: rnk
Date: Wed Aug 26 17:23:50 2015
New Revision: 246096
URL: http://llvm.org/viewvc/llvm-project?rev=246096&view=rev
Log:
Handle suppression files ending in CRLF (\r\n)
The gnuwin32 version of 'echo' appears to produce such files, causing a
test failure that only reproduced with gnuwin32.
Added:
compiler-rt/trunk/test/asan/TestCases/Windows/suppressions-crlf.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc?rev=246096&r1=246095&r2=246096&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_suppressions.cc Wed Aug 26 17:23:50 2015
@@ -112,7 +112,8 @@ void SuppressionContext::Parse(const cha
end = line + internal_strlen(line);
if (line != end && line[0] != '#') {
const char *end2 = end;
- while (line != end2 && (end2[-1] == ' ' || end2[-1] == '\t'))
+ while (line != end2 &&
+ (end2[-1] == ' ' || end2[-1] == '\t' || end2[-1] == '\r'))
end2--;
int type;
for (type = 0; type < suppression_types_num_; type++) {
Added: compiler-rt/trunk/test/asan/TestCases/Windows/suppressions-crlf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/suppressions-crlf.cc?rev=246096&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/suppressions-crlf.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/suppressions-crlf.cc Wed Aug 26 17:23:50 2015
@@ -0,0 +1,19 @@
+// Try a strlen suppression, but force the input file to be DOS format (CRLF).
+// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: echo "interceptor_name:strlen" > %t.supp
+// RUN: unix2dos %t.supp
+// RUN: %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck %s
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main() {
+ char *a = (char *)malloc(6);
+ free(a);
+ size_t len = strlen(a); // BOOM
+ fprintf(stderr, "strlen ignored, len = %zu\n", len);
+}
+
+// CHECK-NOT: AddressSanitizer: heap-use-after-free
+// CHECK: strlen ignored
More information about the llvm-commits
mailing list