You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/26 01:00:24 UTC

[doris] branch branch-1.1-lts updated: [BugFix](replace function) fix infinite loop in replace function #13618

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new c7ca5f5b6c [BugFix](replace function) fix infinite loop in replace function #13618
c7ca5f5b6c is described below

commit c7ca5f5b6c974770d392ecbca9e4b5ed56f0f624
Author: AlexYue <yj...@gmail.com>
AuthorDate: Wed Oct 26 09:00:17 2022 +0800

    [BugFix](replace function) fix infinite loop in replace function #13618
---
 be/src/vec/functions/function_string.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h
index f0566b2d80..0490238d9c 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -1322,6 +1322,9 @@ public:
 
 private:
     std::string replace(std::string str, std::string_view old_str, std::string_view new_str) {
+        if (old_str.empty()) {
+            return str;
+        }
         std::string::size_type pos = 0;
         std::string::size_type oldLen = old_str.size();
         std::string::size_type newLen = new_str.size();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org