From d025923533d50d49ff56d970dee4058f1607f74c Mon Sep 17 00:00:00 2001 From: Rongqi Sun Date: Wed, 17 Apr 2024 03:03:43 +0000 Subject: [PATCH] bluestore/bluestore_types: avoid heap-buffer-overflow in another way to keep code uniformity Signed-off-by: Rongqi Sun (cherry picked from commit 8564caf393a8fe6ef1bb1741a399ab264397648c) --- src/os/bluestore/bluestore_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index dd1773c6ad2..6438ba07d00 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; } } -- 2.47.3