[CP] fix int_cell_str sanity core && fix mysqltest
This commit is contained in:
20
deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp
vendored
20
deps/oblib/src/rpc/obmysql/ob_mysql_util.cpp
vendored
@ -360,16 +360,22 @@ int ObMySQLUtil::int_cell_str(
|
|||||||
}
|
}
|
||||||
/* skip bytes_to_store_len bytes to store length */
|
/* skip bytes_to_store_len bytes to store length */
|
||||||
int64_t bytes_to_store_len = get_number_store_len(length);
|
int64_t bytes_to_store_len = get_number_store_len(length);
|
||||||
MEMCPY(buf + pos + bytes_to_store_len, ffi.ptr(), ffi.length());
|
if (OB_UNLIKELY(pos + bytes_to_store_len + ffi.length() > len)) {
|
||||||
if (zero_cnt > 0) {
|
ret = OB_SIZE_OVERFLOW;
|
||||||
/*zero_cnt > 0 indicates that zerofill is true */
|
} else if (zero_cnt > 0 && OB_UNLIKELY(pos + bytes_to_store_len + zero_cnt > len)) {
|
||||||
MEMSET(buf + pos + bytes_to_store_len, '0', zero_cnt);
|
ret = OB_SIZE_OVERFLOW;
|
||||||
MEMCPY(buf + pos + bytes_to_store_len + zero_cnt, ffi.ptr(), ffi.length());
|
|
||||||
} else {
|
} else {
|
||||||
MEMCPY(buf + pos + bytes_to_store_len, ffi.ptr(), ffi.length());
|
MEMCPY(buf + pos + bytes_to_store_len, ffi.ptr(), ffi.length());
|
||||||
|
if (zero_cnt > 0) {
|
||||||
|
/*zero_cnt > 0 indicates that zerofill is true */
|
||||||
|
MEMSET(buf + pos + bytes_to_store_len, '0', zero_cnt);
|
||||||
|
MEMCPY(buf + pos + bytes_to_store_len + zero_cnt, ffi.ptr(), ffi.length());
|
||||||
|
} else {
|
||||||
|
MEMCPY(buf + pos + bytes_to_store_len, ffi.ptr(), ffi.length());
|
||||||
|
}
|
||||||
|
ret = ObMySQLUtil::store_length(buf, pos + bytes_to_store_len, length, pos);
|
||||||
|
pos += length;
|
||||||
}
|
}
|
||||||
ret = ObMySQLUtil::store_length(buf, pos + bytes_to_store_len, length, pos);
|
|
||||||
pos += length;
|
|
||||||
} else {
|
} else {
|
||||||
switch (obj_type) {
|
switch (obj_type) {
|
||||||
case ObTinyIntType:
|
case ObTinyIntType:
|
||||||
|
|||||||
Reference in New Issue
Block a user