Skip to content

Commit

Permalink
dynamicbloom fix: don't offset address when it is already aligned
Browse files Browse the repository at this point in the history
Summary: this causes overflow and asan failure

Test Plan: make asan_check

Reviewers: igor

Reviewed By: igor

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17301
  • Loading branch information
Lei Jin committed Mar 29, 2014
1 parent 43a593a commit 550cca7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/dynamic_bloom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ DynamicBloom::DynamicBloom(uint32_t total_bits,
sz += CACHE_LINE_SIZE - 1;
}
raw_ = new unsigned char[sz]();
if (kBlocked) {
if (kBlocked && (reinterpret_cast<uint64_t>(raw_) % CACHE_LINE_SIZE)) {
data_ = raw_ + CACHE_LINE_SIZE -
reinterpret_cast<uint64_t>(raw_) % CACHE_LINE_SIZE;
} else {
Expand Down

0 comments on commit 550cca7

Please sign in to comment.