From: Rongqi Sun Date: Wed, 17 Apr 2024 03:03:43 +0000 (+0000) Subject: bluestore/bluestore_types: avoid heap-buffer-overflow in another way to keep code... X-Git-Tag: v17.2.8~237^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F58818%2Fhead;p=ceph.git bluestore/bluestore_types: avoid heap-buffer-overflow in another way to keep code uniformity Signed-off-by: Rongqi Sun (cherry picked from commit 8564caf393a8fe6ef1bb1741a399ab264397648c) --- diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index dd1773c6ad29..6438ba07d00e 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -1310,12 +1310,12 @@ struct sb_info_space_efficient_map_t { if (aux_items.size() != 0) { auto it = std::lower_bound( aux_items.begin(), - aux_items.end(), + aux_items.end() - 1, id, [](const sb_info_t& a, const uint64_t& b) { return a < b; }); - if (it != aux_items.end() && it->get_sbid() == id) { + if (it->get_sbid() == id) { return it; } }