From 5219d9a723327bab5d29046eb02fa7fc41e7c12e Mon Sep 17 00:00:00 2001 From: cqy123456 <39671710+cqy123456@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:26:37 +0800 Subject: [PATCH] fix: Inserting null and non-null array at the same time will cause milvus crash when growing mmap open (#41051) issue: https://github.com/milvus-io/milvus/issues/40981 2.5 pr: https://github.com/milvus-io/milvus/pull/41052 Signed-off-by: cqy123456 --- internal/core/src/mmap/ChunkData.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/core/src/mmap/ChunkData.h b/internal/core/src/mmap/ChunkData.h index edc5f1a1b4..42de567b0f 100644 --- a/internal/core/src/mmap/ChunkData.h +++ b/internal/core/src/mmap/ChunkData.h @@ -214,9 +214,7 @@ VariableLengthChunk::set( size_t total_size = 0; for (auto i = 0; i < length; i++) { total_size += src[i].byte_size(); - } - if (length > 0 && IsVariableDataType(src[0].get_element_type())) { - for (auto i = 0; i < length; i++) { + if (IsVariableDataType(src[i].get_element_type())) { total_size += (src[i].length() * sizeof(uint32_t)); } }