forked from OSchip/llvm-project
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. llvm-svn: 246096
This commit is contained in:
parent
31d38f70ea
commit
ac86c29bd0
|
|
@ -112,7 +112,8 @@ void SuppressionContext::Parse(const char *str) {
|
|||
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++) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue