This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 309d5bd8f08 [chore](Fix) Fix uninitilized buffer in read_cluster_id() (#29949) 309d5bd8f08 is described below commit 309d5bd8f087c6dea686761c8ecbebffd7a7063f Author: Gavin Chou <gavineaglec...@gmail.com> 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 742c2fd8f36..e84ebd403b0 100644 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -80,9 +80,10 @@ Status read_cluster_id(const std::string& cluster_id_path, int32_t* cluster_id) 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: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org