Skip to content

Commit

Permalink
fix a division by zero bug
Browse files Browse the repository at this point in the history
Summary:
fixes the failing clang_analyze contrun test
Closes facebook#3872

Differential Revision: D8059241

Pulled By: miasantreble

fbshipit-source-id: e8fc1838004fe16a823456188386b8b39429803b
  • Loading branch information
miasantreble authored and facebook-github-bot committed May 19, 2018
1 parent 26da367 commit ed4d339
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion db/db_iter_stress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,14 @@ TEST_F(DBIteratorStressTest, StressTest) {
Random64 rnd(826909345792864532ll);

auto gen_key = [&](int max_key) {
assert(max_key > 0);
int len = 0;
int a = max_key;
while (a) {
a /= 10;
++len;
}
std::string s = ToString(rnd.Next() % (uint64_t)max_key);
std::string s = ToString(rnd.Next() % static_cast<uint64_t>(max_key));
s.insert(0, len - (int)s.size(), '0');
return s;
};
Expand Down

0 comments on commit ed4d339

Please sign in to comment.