Files
clang-p2996/compiler-rt/test/fuzzer/reload.test
Vitaly Buka 3db6ad2bcf Use binary write mode in WriteToFile function to avoid appended \r characters on Windows
Summary:
When using libfuzzer on Windows, in the contents of a crash sample, bytes that can be mistaken for a \n are replaced by a \r\n sequence. As a consequence, crashes are not reproducible. This patch will open files in binary mode to fix this issue. The patch does not affect POSIX systems.

Patch by tuktuk

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: dexonsmith, jdoerfert, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

Differential Revision: https://reviews.llvm.org/D60008

llvm-svn: 357807
2019-04-05 20:17:03 +00:00

14 lines
528 B
Plaintext

RUN: %cpp_compiler %S/ReloadTest.cpp -o %t-ReloadTest
RUN: not %run %t-ReloadTest -max_len=10000 -seed=1 -timeout=15 -len_control=0 -exact_artifact_path=%t.crash 2>&1 | FileCheck %s
CHECK: Test unit written to {{.*}}reload.test.tmp.crash
RUN: not %run %t-ReloadTest %t.crash 2>&1 | FileCheck %s --check-prefix=ARTIFACT
ARTIFACT: Running: {{.*}}reload.test.tmp.crash
ARTIFACT: ERROR: libFuzzer: deadly signal
# Sanity check that altered artifact is not going to crash
RUN: echo z >> %t.crash
RUN: %run %t-ReloadTest %t.crash