From: Samuel Just Date: Sat, 21 Dec 2019 02:04:47 +0000 (+0000) Subject: fastbmap_allocator_impl: avoid std::vector[] for oob index X-Git-Tag: v15.1.0~91^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9c89b16a8c3dfefd3a2d93dea533350377178ff5;p=ceph.git fastbmap_allocator_impl: avoid std::vector[] for oob index This was relatively harmless as the pointer won't actually be dereferenced, but it runs afoul of std::vector's bounds checks with _GLIBCXX_ASSERTIONS enabled. Signed-off-by: Samuel Just --- diff --git a/src/os/bluestore/fastbmap_allocator_impl.cc b/src/os/bluestore/fastbmap_allocator_impl.cc index 22e18c7141bf..441a185d5c72 100644 --- a/src/os/bluestore/fastbmap_allocator_impl.cc +++ b/src/os/bluestore/fastbmap_allocator_impl.cc @@ -286,7 +286,7 @@ void AllocatorLevel01Loose::_mark_alloc_l0(int64_t l0_pos_start, int64_t pos = l0_pos_start; slot_t bits = (slot_t)1 << (l0_pos_start % d0); - slot_t* val_s = &l0[pos / d0]; + slot_t* val_s = l0.data() + (pos / d0); int64_t pos_e = std::min(l0_pos_end, p2roundup(l0_pos_start + 1, d0)); while (pos < pos_e) { (*val_s) &= ~bits;