Skip to content

Commit 20010dc

Browse files
committed
fix move right and read off the end of array
1 parent f496dc4 commit 20010dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cn/kvset_split.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ vblocks_split(
653653

654654
if (!move_left) {
655655
/* Add the vblocks in [boundary, end] to the right kvset */
656-
boundary = overlapping_access ? split : split + 1;
656+
boundary = (overlapping_access || move_right) ? split : split + 1;
657657
for (uint16_t j = boundary; j <= end; j++) {
658658
uint32_t alen;
659659
uint64_t mbid;
@@ -724,7 +724,7 @@ vblocks_split(
724724
if (!move_right) {
725725
/* Add vblocks in [start, boundary] to the left kvset */
726726
vbcnt = 0; /* reset vbcnt for the left kvset */
727-
boundary = split;
727+
boundary = min(split, end);
728728
for (uint16_t j = start; j <= boundary; j++) {
729729
uint32_t alen;
730730
uint64_t mbid;

0 commit comments

Comments
 (0)