fix: [2.6]Fix the geometry return POINT(0 0) when growing mmap is enabled (#44890)

issue: #44802 
master pr: #44889 

After a Geometry object is serialized into WKB, the resulting binary may
contain '\0' bytes.
When growing mmap is enabled, the append data logic uses strcpy, which
stops copying at the first '\0' bytes.
This causes only part of the WKB---typically the portion up to the
geometry type field to be copied, leading to corrupted data.
As a result, during parsing, all POINT geometries are incorrectly
interperted as POINT(0 0).

To fix this issue, memcpy will be used instead of strcpy.

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2025-10-17 17:14:23 +08:00 committed by GitHub
parent dd62691438
commit 2dea67cc20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,7 +124,7 @@ VariableLengthChunk<std::string>::set(
data_[i + begin] = std::string_view("");
} else {
char* data_ptr = buf + offset;
std::strcpy(data_ptr, src[i].c_str());
std::memcpy(data_ptr, src[i].data(), src[i].size());
data_[i + begin] = std::string_view(data_ptr, src[i].size());
}
offset += data_size;