From 18c3958dbe477be57379e227e3cfcf43271907cf Mon Sep 17 00:00:00 2001 From: 2149 <260391947@qq.com> Date: Tue, 11 Jul 2023 13:24:28 +0000 Subject: [PATCH] [CP] fix hexstring convert bug --- src/share/object/ob_obj_cast.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/share/object/ob_obj_cast.cpp b/src/share/object/ob_obj_cast.cpp index 1690f23e5..89eeb3fd4 100644 --- a/src/share/object/ob_obj_cast.cpp +++ b/src/share/object/ob_obj_cast.cpp @@ -4915,7 +4915,19 @@ int common_string_integer(const ObCastMode &cast_mode, { int ret = OB_SUCCESS; if (ObHexStringType == in_type) { - out_val = static_cast(hex_to_uint64(in_str)); + ObObj uint64_in; + ObObj out; + ObObjCastParams dummy; + ObCastMode uint_int_cm = cast_mode; + uint64_in.set_uint64(hex_to_uint64(in_str)); + if (CM_IS_EXPLICIT_CAST(cast_mode)) { + uint_int_cm |= CM_NO_RANGE_CHECK; + } + if (OB_FAIL(uint_int(ObIntType, dummy, uint64_in, out, uint_int_cm))) { + LOG_WARN("convert hex string to int64 failed", K(ret)); + } else { + out_val = out.get_int(); + } } else { int err = 0; char *endptr = NULL;