This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new aa4db3d7e56 branch-3.1: [Bug](function) fix to_ipv6 cause
stack-buffer-overflow error #53713 (#54012)
aa4db3d7e56 is described below
commit aa4db3d7e56b2f4a106bbad54026b52262951902
Author: zhangstar333 <[email protected]>
AuthorDate: Wed Jul 30 15:40:59 2025 +0800
branch-3.1: [Bug](function) fix to_ipv6 cause stack-buffer-overflow error
#53713 (#54012)
Cherry-picked from #53423
---
be/src/vec/common/format_ip.h | 6 +++---
be/src/vec/functions/function_ip.h | 4 +---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/be/src/vec/common/format_ip.h b/be/src/vec/common/format_ip.h
index 45f90d3bdad..4d9b104fd63 100644
--- a/be/src/vec/common/format_ip.h
+++ b/be/src/vec/common/format_ip.h
@@ -124,12 +124,12 @@ inline void format_ipv4(const unsigned char* src, char*&
dst, uint8_t mask_tail_
*/
template <typename T, typename EOFfunction>
requires(std::is_same<typename std::remove_cv<T>::type, char>::value)
-inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned char* dst, int64_t
first_octet = -1) {
+inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned char* dst, int32_t
first_octet = -1) {
if (src == nullptr || first_octet > IPV4_MAX_OCTET_VALUE) {
return false;
}
- int64_t result = 0;
+ UInt32 result = 0;
int offset = (IPV4_BINARY_LENGTH - 1) * IPV4_OCTET_BITS;
if (first_octet >= 0) {
result |= first_octet << offset;
@@ -141,7 +141,7 @@ inline bool parse_ipv4(T*& src, EOFfunction eof, unsigned
char* dst, int64_t fir
return false;
}
- int64_t value = 0;
+ UInt32 value = 0;
size_t len = 0;
while (is_numeric_ascii(*src) && len <= 3) {
value = value * DECIMAL_BASE + (*src - '0');
diff --git a/be/src/vec/functions/function_ip.h
b/be/src/vec/functions/function_ip.h
index c75ae4002b9..38b3b8d4d72 100644
--- a/be/src/vec/functions/function_ip.h
+++ b/be/src/vec/functions/function_ip.h
@@ -150,10 +150,8 @@ ColumnPtr convert_to_ipv4(ColumnPtr column, const
PaddedPODArray<UInt8>* null_ma
vec_null_map_to = &col_null_map_to->get_data();
}
- auto col_res = ToColumn::create();
-
+ auto col_res = ToColumn::create(column_size, 0);
auto& vec_res = col_res->get_data();
- vec_res.resize(column_size);
const ColumnString::Chars& vec_src = column_string->get_chars();
const ColumnString::Offsets& offsets_src = column_string->get_offsets();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]