Commit dd52ab90 authored by Doron Roberts-Kedes's avatar Doron Roberts-Kedes Committed by Facebook Github Bot

Fix parent_->segments_ index out of bounds bug.

Summary: Found while testing with BufferedDeterministicAtomic.

Reviewed By: djwatson

Differential Revision: D13509000

fbshipit-source-id: ec1cef0afc888136db3ccda8dff99bc0a45f6bff
parent c68fd6e3
...@@ -454,13 +454,13 @@ class ConcurrentHashMap { ...@@ -454,13 +454,13 @@ class ConcurrentHashMap {
explicit ConstIterator(uint64_t shards) : it_(nullptr), segment_(shards) {} explicit ConstIterator(uint64_t shards) : it_(nullptr), segment_(shards) {}
void next() { void next() {
while (it_ == parent_->ensureSegment(segment_)->cend() && while (segment_ < parent_->NumShards &&
segment_ < parent_->NumShards) { it_ == parent_->ensureSegment(segment_)->cend()) {
SegmentT* seg{nullptr}; SegmentT* seg{nullptr};
while (!seg) { while (!seg) {
segment_++; segment_++;
seg = parent_->segments_[segment_].load(std::memory_order_acquire);
if (segment_ < parent_->NumShards) { if (segment_ < parent_->NumShards) {
seg = parent_->segments_[segment_].load(std::memory_order_acquire);
if (!seg) { if (!seg) {
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment