From 0ab6fc167ffff431d72499f7bcda64e1d67a16d7 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 14 Dec 2016 19:20:42 -0800 Subject: [PATCH] Gcc-7 buffer size insufficient Summary: Bunch of commits related to insufficient buffer size. Errors in individual commits. Closes https://github.com/facebook/rocksdb/pull/1673 Differential Revision: D4332127 Pulled By: IslamAbdelRahman fbshipit-source-id: 878f73c --- tools/db_bench_tool.cc | 2 +- util/transaction_test_util.cc | 2 +- utilities/simulator_cache/sim_cache.cc | 2 +- utilities/transactions/transaction_util.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index cf0678a85..c61ffac7e 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -2615,7 +2615,7 @@ class Benchmark { if (!ok) { thread->stats.AddMessage("(compression failure)"); } else { - char buf[100]; + char buf[340]; snprintf(buf, sizeof(buf), "(output: %.1f%%)", (produced * 100.0) / bytes); thread->stats.AddMessage(buf); diff --git a/util/transaction_test_util.cc b/util/transaction_test_util.cc index 7ec990374..3d1764b90 100644 --- a/util/transaction_test_util.cc +++ b/util/transaction_test_util.cc @@ -190,7 +190,7 @@ Status RandomTransactionInserter::Verify(DB* db, uint16_t num_sets) { // For each set of keys with the same prefix, sum all the values for (uint32_t i = 0; i < num_sets; i++) { - char prefix_buf[5]; + char prefix_buf[6]; snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", i + 1); uint64_t total = 0; diff --git a/utilities/simulator_cache/sim_cache.cc b/utilities/simulator_cache/sim_cache.cc index 45e1fc54a..3145c186f 100644 --- a/utilities/simulator_cache/sim_cache.cc +++ b/utilities/simulator_cache/sim_cache.cc @@ -136,7 +136,7 @@ class SimCacheImpl : public SimCache { std::string res; res.append("SimCache MISSes: " + std::to_string(get_miss_counter()) + "\n"); res.append("SimCache HITs: " + std::to_string(get_hit_counter()) + "\n"); - char buff[100]; + char buff[350]; auto lookups = get_miss_counter() + get_hit_counter(); snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n", (lookups == 0 ? 0 : get_hit_counter() * 100.0f / lookups)); diff --git a/utilities/transactions/transaction_util.cc b/utilities/transactions/transaction_util.cc index 363e8dece..5baf5816d 100644 --- a/utilities/transactions/transaction_util.cc +++ b/utilities/transactions/transaction_util.cc @@ -81,7 +81,7 @@ Status TransactionUtil::CheckKey(DBImpl* db_impl, SuperVersion* sv, if (cache_only) { // The age of this memtable is too new to use to check for recent // writes. - char msg[255]; + char msg[300]; snprintf(msg, sizeof(msg), "Transaction could not check for conflicts for operation at " "SequenceNumber %" PRIu64