From 38a3428b37a3b21d2a699b8e1db1f10af57588b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Sun, 5 Mar 2017 19:36:56 -0800
Subject: [PATCH] support -Werror=format-security
Fedora now enables this option by default, resulting
in the following build failure:
Logging.h: In instantiation of
'void pzstd::Logger::operator()(int, const char*, Args ...)
Pzstd.cpp:413:48: required from here
Logging.h:46:17: error: format not a string literal and no format arguments
[-Werror=format-security]
std::fprintf(out_, fmt, args...);
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
---
.buckconfig | 2 +-
contrib/pzstd/Pzstd.cpp | 6 +++---
contrib/pzstd/Pzstd.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/.buckconfig b/.buckconfig
index b2b9c036f..d698b35ba 100644
--- a/.buckconfig
+++ b/.buckconfig
@@ -2,7 +2,7 @@
cppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1
cflags = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith
cxxppflags = -DXXH_NAMESPACE=ZSTD_ -DZSTD_LEGACY_SUPPORT=1
- cxxflags = -std=c++11 -Wno-format-security -Wno-deprecated-declarations
+ cxxflags = -std=c++11 -Wno-deprecated-declarations
gtest_dep = //contrib/pzstd:gtest
[httpserver]
diff --git a/contrib/pzstd/Pzstd.cpp b/contrib/pzstd/Pzstd.cpp
index f4cb19d9c..1265b53ef 100644
--- a/contrib/pzstd/Pzstd.cpp
+++ b/contrib/pzstd/Pzstd.cpp
@@ -410,7 +410,7 @@ std::uint64_t asyncCompressChunks(
});
// Pass the output queue to the writer thread.
chunks.push(std::move(out));
- state.log(VERBOSE, "Starting a new frame\n");
+ state.log(VERBOSE, "%s\n", "Starting a new frame");
// Fill the input queue for the compression job we just started
status = readData(*in, ZSTD_CStreamInSize(), step, fd, &bytesRead);
}
@@ -547,8 +547,8 @@ std::uint64_t asyncDecompressFrames(
if (frameSize == 0) {
// We hit a non SkippableFrame ==> not compressed by pzstd or corrupted
// Pass the rest of the source to this decompression task
- state.log(VERBOSE,
- "Input not in pzstd format, falling back to serial decompression\n");
+ state.log(VERBOSE, "%s\n",
+ "Input not in pzstd format, falling back to serial decompression");
while (status == FileStatus::Continue && !state.errorHolder.hasError()) {
status = readData(*in, chunkSize, chunkSize, fd, &totalBytesRead);
}
diff --git a/contrib/pzstd/Pzstd.h b/contrib/pzstd/Pzstd.h
index dc60dd9b8..1e29a7170 100644
--- a/contrib/pzstd/Pzstd.h
+++ b/contrib/pzstd/Pzstd.h
@@ -41,7 +41,7 @@ class SharedState {
auto parameters = options.determineParameters();
cStreamPool.reset(new ResourcePool