[compiler-rt] d02ff3d - Revert "[fuzzer] Use puts() rather than printf() in CopyFileToErr()"
Matthew Voss via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 17 16:01:43 PDT 2023
Author: Matthew Voss
Date: 2023-03-17T16:00:56-07:00
New Revision: d02ff3d578312f4924b7d3926666ea454239bf25
URL: https://github.com/llvm/llvm-project/commit/d02ff3d578312f4924b7d3926666ea454239bf25
DIFF: https://github.com/llvm/llvm-project/commit/d02ff3d578312f4924b7d3926666ea454239bf25.diff
LOG: Revert "[fuzzer] Use puts() rather than printf() in CopyFileToErr()"
This reverts commit 03aa02adb03c928ae4ec9d139b303348f81861c9.
Reverting due to bot failures:
https://lab.llvm.org/buildbot/#/builders/247/builds/2653
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerIO.cpp
compiler-rt/lib/fuzzer/FuzzerIO.h
Removed:
compiler-rt/test/fuzzer/BigFileCopy.cpp
compiler-rt/test/fuzzer/big-file-copy.test
################################################################################
diff --git a/compiler-rt/lib/fuzzer/FuzzerIO.cpp b/compiler-rt/lib/fuzzer/FuzzerIO.cpp
index 54cc4ee54be0a..0a58c5377b34f 100644
--- a/compiler-rt/lib/fuzzer/FuzzerIO.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerIO.cpp
@@ -65,7 +65,7 @@ std::string FileToString(const std::string &Path) {
}
void CopyFileToErr(const std::string &Path) {
- Puts(FileToString(Path).c_str());
+ Printf("%s", FileToString(Path).c_str());
}
void WriteToFile(const Unit &U, const std::string &Path) {
@@ -151,11 +151,6 @@ void CloseStdout() {
DiscardOutput(1);
}
-void Puts(const char *Str) {
- fputs(Str, OutputFile);
- fflush(OutputFile);
-}
-
void Printf(const char *Fmt, ...) {
va_list ap;
va_start(ap, Fmt);
diff --git a/compiler-rt/lib/fuzzer/FuzzerIO.h b/compiler-rt/lib/fuzzer/FuzzerIO.h
index 874caad1baedb..401afa0b44773 100644
--- a/compiler-rt/lib/fuzzer/FuzzerIO.h
+++ b/compiler-rt/lib/fuzzer/FuzzerIO.h
@@ -58,7 +58,6 @@ void CloseStdout();
FILE *GetOutputFile();
void SetOutputFile(FILE *NewOutputFile);
-void Puts(const char *Str);
void Printf(const char *Fmt, ...);
void VPrintf(bool Verbose, const char *Fmt, ...);
diff --git a/compiler-rt/test/fuzzer/BigFileCopy.cpp b/compiler-rt/test/fuzzer/BigFileCopy.cpp
deleted file mode 100644
index 42a2a84f82fc9..0000000000000
--- a/compiler-rt/test/fuzzer/BigFileCopy.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-
-#include "FuzzerIO.h"
-
-int main(int argc, char *argv[]) {
- assert(argc == 2);
- const char *FileName = argv[1];
- FILE *f = fopen(FileName, "w");
-
- // This is the biggest file possible unless CopyFileToErr() uses Puts()
- fprintf(f, "%2147483646s", "2Gb-2");
-
- // This makes the file too big if CopyFileToErr() uses fprintf("%s", <file>)
- fprintf(f, "THIS LINE RESPONSIBLE FOR EXCEEDING 2Gb FILE SIZE\n");
- fclose(f);
-
- // Should now because CopyFileToErr() now uses Puts()
- fuzzer::CopyFileToErr(FileName);
-
- // File is >2Gb so clean up
- remove(FileName);
-
- return 0;
-}
diff --git a/compiler-rt/test/fuzzer/big-file-copy.test b/compiler-rt/test/fuzzer/big-file-copy.test
deleted file mode 100644
index 642b7cbf154e4..0000000000000
--- a/compiler-rt/test/fuzzer/big-file-copy.test
+++ /dev/null
@@ -1,4 +0,0 @@
-RUN: %cpp_compiler %S/BigFileCopy.cpp -o %t
-RUN: %run %t big-file.txt 2>big-file-out.txt; result=$?
-RUN: %run rm -f big-file.txt big-file-out.txt
-RUN: %run (exit $result)
More information about the llvm-commits
mailing list