[compiler-rt] r246096 - Handle suppression files ending in CRLF (\r\n)

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 20:26:27 PDT 2015


Please don't rely on unix2dos. Comitting a file with \r\n is much better
than adding dependencies like this.
I also don't think this test should be Windows only.

Thank you,

  Filipe

On Wednesday, August 26, 2015, Reid Kleckner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <javascript:;>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


-- 
  F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150826/af2a7b28/attachment.html>


More information about the llvm-commits mailing list