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 1835a8c9bb8 [fix](snapshot-loader) Fix be crash caused by deref end() iterator (#32489) 1835a8c9bb8 is described below commit 1835a8c9bb81a2849ba968afc4e48680e2de4b0d Author: walter <w41te...@gmail.com> AuthorDate: Wed Mar 20 08:54:42 2024 +0800 [fix](snapshot-loader) Fix be crash caused by deref end() iterator (#32489) The standard said that the input parameter `pos` of std::vector::erase must be valid and dereferenceable, the `end()` iterator cannot be used as a value of `pos`. I did some tests and the crash only occurs when the vector is empty. Fortunately `local_files` is usually not empty. --- be/src/runtime/snapshot_loader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/snapshot_loader.cpp b/be/src/runtime/snapshot_loader.cpp index 55b7d35f42e..8032084378b 100644 --- a/be/src/runtime/snapshot_loader.cpp +++ b/be/src/runtime/snapshot_loader.cpp @@ -338,7 +338,9 @@ Status SnapshotLoader::download(const std::map<std::string, std::string>& src_to } // remove file which will be downloaded now. // this file will be added to local_files if it be downloaded successfully. - local_files.erase(find); + if (find != local_files.end()) { + local_files.erase(find); + } RETURN_IF_ERROR(_remote_fs->download(full_remote_file, full_local_file)); // 3. check md5 of the downloaded file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org