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 <zhangsida@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
03994b8d93
commit
2f7c15f38e
@ -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));
|
||||
}
|
||||
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user