[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:51:53 PDT 2015


Yeah, that's true. I'm still not happy about adding additional
dependencies...
Python is a dependency, though. I guess a small Python one liner would work.

On Wednesday, August 26, 2015, Sean Silva <chisophugis at gmail.com> wrote:

>
>
> On Wed, Aug 26, 2015 at 8:26 PM, Filipe Cabecinhas via llvm-commits <
> llvm-commits at lists.llvm.org
> <javascript:_e(%7B%7D,'cvml','llvm-commits at lists.llvm.org');>> wrote:
>
>> 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.
>>
>
> VCS are notorious for changing line endings in various ways. I don't think
> that unix2dos is a great solution, but it at least the failure mode is
> "blows up; program not found" instead of silently doing something else.
>
> -- Sean Silva
>
>
>
>>
>>
>> Thank you,
>>
>>   Filipe
>>
>>
>> On Wednesday, August 26, 2015, Reid Kleckner via llvm-commits <
>> llvm-commits at lists.llvm.org
>> <javascript:_e(%7B%7D,'cvml','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
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
>> --
>>   F
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> <javascript:_e(%7B%7D,'cvml','llvm-commits at lists.llvm.org');>
>> 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/a7a1432f/attachment.html>


More information about the llvm-commits mailing list