From 2abd761ba5e96ab0f7e5545d1f8087659574b113 Mon Sep 17 00:00:00 2001 From: nichideropa <86486931+nichideropa@users.noreply.github.com> Date: Sun, 11 May 2025 13:13:15 +0200 Subject: [PATCH 1/2] fix potential overflow by casting one operand to lager integer type --- src/observer/storage/index/bplus_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/observer/storage/index/bplus_tree.cpp b/src/observer/storage/index/bplus_tree.cpp index d0d48f336..5681fcbeb 100644 --- a/src/observer/storage/index/bplus_tree.cpp +++ b/src/observer/storage/index/bplus_tree.cpp @@ -281,7 +281,7 @@ RC LeafIndexNodeHandler::move_half_to(LeafIndexNodeHandler &other) other.append(__item_at(move_index), move_item_num); - RC rc = mtr_.logger().node_remove_items(*this, move_index, span(__item_at(move_index), move_item_num * item_size()), move_item_num); + RC rc = mtr_.logger().node_remove_items(*this, move_index, span(__item_at(move_index), static_cast(move_item_num) * item_size()), move_item_num); if (OB_FAIL(rc)) { LOG_WARN("failed to log shrink leaf node. rc=%s", strrc(rc)); return rc; From 6b0a35f7633992f78eaac2f23d3b63ca694d4c88 Mon Sep 17 00:00:00 2001 From: nichideropa <86486931+nichideropa@users.noreply.github.com> Date: Sat, 17 May 2025 22:57:43 +0200 Subject: [PATCH 2/2] cast to size_t --- src/observer/storage/index/bplus_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/observer/storage/index/bplus_tree.cpp b/src/observer/storage/index/bplus_tree.cpp index 5681fcbeb..aa63c63c7 100644 --- a/src/observer/storage/index/bplus_tree.cpp +++ b/src/observer/storage/index/bplus_tree.cpp @@ -281,7 +281,7 @@ RC LeafIndexNodeHandler::move_half_to(LeafIndexNodeHandler &other) other.append(__item_at(move_index), move_item_num); - RC rc = mtr_.logger().node_remove_items(*this, move_index, span(__item_at(move_index), static_cast(move_item_num) * item_size()), move_item_num); + RC rc = mtr_.logger().node_remove_items(*this, move_index, span(__item_at(move_index), static_cast(move_item_num) * item_size()), move_item_num); if (OB_FAIL(rc)) { LOG_WARN("failed to log shrink leaf node. rc=%s", strrc(rc)); return rc;