[json bugfix] json_query array out of range

This commit is contained in:
Carrot-77
2024-04-22 09:39:50 +00:00
committed by ob-robot
parent 9de65fb1d7
commit dcf8d2d9b5
2 changed files with 8 additions and 1 deletions

View File

@ -824,6 +824,7 @@ int ObExprJsonQuery::deal_item_method_special_case(ObJsonPath* j_path,
INIT_SUCC(ret);
if (hits[pos]->json_type() == ObJsonNodeType::J_NULL && !hits[pos]->is_real_json_null(hits[pos])) {
is_null_result = true;
} else if (!j_path->is_last_func()) { // do nothing
} else if (!use_wrapper && j_path->is_last_func() && j_path->path_node_cnt() == 1) { // do nothing
} else if (j_path->get_last_node_type() == JPN_LENGTH && !(hits[pos]->json_type() == ObJsonNodeType::J_UINT
&& ((ObJsonUint *)hits[pos])->get_is_string_length())) { // distinct uint and length()

View File

@ -3105,8 +3105,14 @@ int ObJsonUtil::get_query_item_method_null_option(ObJsonPath* j_path,
{
size_t item_method = static_cast<uint8_t>(j_path->get_last_node_type());
size_t json_type = static_cast<uint8_t>(j_base->json_type());
int is_null_res = 0;
// first item method pos is JPN_ABS
return OB_JSON_QUERY_ITEM_METHOD_NULL_OPTION[item_method - ObJsonPathNodeType::JPN_ABS][json_type];
if (!j_path->is_last_func()) {
// do nothing
} else {
is_null_res = OB_JSON_QUERY_ITEM_METHOD_NULL_OPTION[item_method - ObJsonPathNodeType::JPN_ABS][json_type];
}
return is_null_res;
}
ObJsonUtil::ObItemMethodValid ObJsonUtil::get_item_method_cast_res_func(ObJsonPath* j_path,