This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit de3fdc7d08ad404c36e1c39441481703ba256b8f Author: Gavin Chou <[email protected]> AuthorDate: Sun Jan 14 15:49:06 2024 +0800 [chore](Fix) Fix uninitilized buffer in read_cluster_id() (#29949) --- be/src/olap/data_dir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index a2323dcbc1e..24dc88169b8 100644 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -157,9 +157,10 @@ Status DataDir::read_cluster_id(const std::string& cluster_id_path, int32_t* clu size_t fsize = reader->size(); if (fsize > 0) { std::string content; - content.reserve(fsize); + content.resize(fsize, '\0'); size_t bytes_read = 0; RETURN_IF_ERROR(reader->read_at(0, {content.data(), fsize}, &bytes_read)); + DCHECK_EQ(fsize, bytes_read); *cluster_id = std::stoi(content); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
