From a6650e75f1f0f692199e467f08a79f297c140e1d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 4 Nov 2026 05:35:16 +0100 Subject: [PATCH] Print the history benchmark's results with a stream Flawfinder flagged the printf in history.cpp (CWE-134), although its format string is a constant. The stream prints the same text, so history.py reads it as before. Signed-off-by: Niels Lohmann --- tests/benchmarks/history/history.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/history/history.cpp b/tests/benchmarks/history/history.cpp index f607bf961..c16fd9d62 100644 --- a/tests/benchmarks/history/history.cpp +++ b/tests/benchmarks/history/history.cpp @@ -17,9 +17,10 @@ #endif #include #include -#include #include #include +#include +#include #include #include #include @@ -64,7 +65,7 @@ static void bench(const char* name, const std::function& f) v.push_back(std::chrono::duration(clk::now() - t0).count() / n); } std::sort(v.begin(), v.end()); - std::printf("%s %.3f\n", name, v[4]); + std::cout << name << ' ' << std::fixed << std::setprecision(3) << v[4] << '\n'; } int main(int, char** argv)