[CP] fix int_cell_str sanity core && fix mysqltest

This commit is contained in:
obdev
2022-12-16 03:37:51 +00:00
committed by ob-robot
parent 4daf50a3d1
commit a7a929259e

View File

@ -360,6 +360,11 @@ 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);
if (OB_UNLIKELY(pos + bytes_to_store_len + ffi.length() > len)) {
ret = OB_SIZE_OVERFLOW;
} else if (zero_cnt > 0 && OB_UNLIKELY(pos + bytes_to_store_len + zero_cnt > len)) {
ret = OB_SIZE_OVERFLOW;
} 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) { if (zero_cnt > 0) {
/*zero_cnt > 0 indicates that zerofill is true */ /*zero_cnt > 0 indicates that zerofill is true */
@ -370,6 +375,7 @@ int ObMySQLUtil::int_cell_str(
} }
ret = ObMySQLUtil::store_length(buf, pos + bytes_to_store_len, length, pos); ret = ObMySQLUtil::store_length(buf, pos + bytes_to_store_len, length, pos);
pos += length; pos += length;
}
} else { } else {
switch (obj_type) { switch (obj_type) {
case ObTinyIntType: case ObTinyIntType: