dynamicbloom fix: don't offset address when it is already aligned

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
main
Lei Jin 11 years ago
parent 43a593a6d9
commit 550cca7192
  1. 2
      util/dynamic_bloom.cc

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

Loading…
Cancel
Save