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
This commit is contained in:
Daniel Black 2016-12-14 19:20:42 -08:00 committed by Facebook Github Bot
parent b7239bf7e0
commit 0ab6fc167f
4 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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));

View File

@ -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