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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2f7c15f38ea branch-2.1: [Bug](function) fix bitmap_from_base64 
function cause heap-buffer-overflow error #53018 (#53044)
2f7c15f38ea is described below

commit 2f7c15f38ea45be6d62e39a30c1302d4efa13949
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jul 11 06:35:40 2025 +0800

    branch-2.1: [Bug](function) fix bitmap_from_base64 function cause 
heap-buffer-overflow error #53018 (#53044)
    
    Cherry-picked from #53018
    
    Co-authored-by: zhangstar333 <[email protected]>
---
 be/src/vec/functions/function_bitmap.cpp                             | 4 ++--
 .../sql_functions/bitmap_functions/test_bitmap_function.groovy       | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/functions/function_bitmap.cpp 
b/be/src/vec/functions/function_bitmap.cpp
index fb0e0471caa..7f8ca009f99 100644
--- a/be/src/vec/functions/function_bitmap.cpp
+++ b/be/src/vec/functions/function_bitmap.cpp
@@ -289,8 +289,8 @@ struct BitmapFromBase64 {
             } else {
                 BitmapValue bitmap_val;
                 if (!bitmap_val.deserialize(decode_buff.data())) {
-                    return Status::RuntimeError(
-                            fmt::format("bitmap_from_base64 decode failed: 
base64: {}", src_str));
+                    return Status::RuntimeError("bitmap_from_base64 decode 
failed: base64: {}",
+                                                std::string(src_str, 
src_size));
                 }
                 res.emplace_back(std::move(bitmap_val));
             }
diff --git 
a/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy
 
b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy
index 42ab4be115b..856622861da 100644
--- 
a/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy
+++ 
b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy
@@ -928,4 +928,9 @@ suite("test_bitmap_function") {
     // BITMAP_FROM_ARRAY
     sql """ set experimental_enable_nereids_planner=true; """
     qt_sql """ select bitmap_to_string(BITMAP_FROM_ARRAY([]));"""
+
+    test {
+        sql """ SELECT bitmap_from_base64('CQoL') AS result; """ 
+        exception "bitmap_from_base64 decode failed"
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to