bugfix: substr expr get wrong result length

This commit is contained in:
obdev
2024-02-08 19:30:43 +00:00
committed by ob-robot
parent 426469c057
commit 626c5536f9
3 changed files with 47 additions and 1 deletions

View File

@ -111,7 +111,7 @@ int ObExprSubstr::calc_result_length(ObExprResType *types_array,
mbmaxlen = 1;
}
if (start_pos > 0 && substr_len > 0) {
if (start_pos + substr_len <= result_len + 1) {
if (start_pos <= INT64_MAX - substr_len && start_pos + substr_len <= result_len + 1) {
if (is_oracle_mode) {
res_len = substr_len * mbmaxlen;
} else {