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 {
explicit ConstIterator(uint64_t shards) : it_(nullptr), segment_(shards) {}
void next() {
while (it_ == parent_->ensureSegment(segment_)->cend() &&
segment_ < parent_->NumShards) {
while (segment_ < parent_->NumShards &&
it_ == parent_->ensureSegment(segment_)->cend()) {
SegmentT* seg{nullptr};
while (!seg) {
segment_++;
seg = parent_->segments_[segment_].load(std::memory_order_acquire);
if (segment_ < parent_->NumShards) {
seg = parent_->segments_[segment_].load(std::memory_order_acquire);
if (!seg) {
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