[to #48216783] fix array access out of range error report
This commit is contained in:
@ -4335,6 +4335,7 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue ¶m_array,
|
|||||||
const ObObjAccessIdx ¤t_access,
|
const ObObjAccessIdx ¤t_access,
|
||||||
int64_t access_i,
|
int64_t access_i,
|
||||||
bool for_write,
|
bool for_write,
|
||||||
|
bool is_assoc_array,
|
||||||
ObLLVMValue ¤t_value,
|
ObLLVMValue ¤t_value,
|
||||||
ObLLVMValue &ret_value_ptr,
|
ObLLVMValue &ret_value_ptr,
|
||||||
ObLLVMBasicBlock& exit)
|
ObLLVMBasicBlock& exit)
|
||||||
@ -4352,7 +4353,7 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue ¶m_array,
|
|||||||
OZ (helper_.create_icmp(is_inited, not_init_value, ObLLVMHelper::ICMP_EQ, not_init));
|
OZ (helper_.create_icmp(is_inited, not_init_value, ObLLVMHelper::ICMP_EQ, not_init));
|
||||||
OZ (helper_.create_cond_br(not_init, not_init_block, after_init_block));
|
OZ (helper_.create_cond_br(not_init, not_init_block, after_init_block));
|
||||||
OZ (helper_.set_insert_point(not_init_block));
|
OZ (helper_.set_insert_point(not_init_block));
|
||||||
OZ (helper_.get_int32(OB_NOT_INIT, ret_value));
|
OZ (helper_.get_int32(OB_ERR_COLLECION_NULL, ret_value));
|
||||||
OZ (helper_.create_store(ret_value, ret_value_ptr));
|
OZ (helper_.create_store(ret_value, ret_value_ptr));
|
||||||
OZ (helper_.create_br(exit));
|
OZ (helper_.create_br(exit));
|
||||||
OZ (helper_.set_insert_point(after_init_block));
|
OZ (helper_.set_insert_point(after_init_block));
|
||||||
@ -4435,7 +4436,7 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue ¶m_array,
|
|||||||
OZ (helper_.create_icmp(high, element_idx, ObLLVMHelper::ICMP_SGT, is_true));
|
OZ (helper_.create_icmp(high, element_idx, ObLLVMHelper::ICMP_SGT, is_true));
|
||||||
OZ (helper_.create_cond_br(is_true, after_block, error_block));
|
OZ (helper_.create_cond_br(is_true, after_block, error_block));
|
||||||
OZ (helper_.set_insert_point(error_block));
|
OZ (helper_.set_insert_point(error_block));
|
||||||
OZ (helper_.get_int32(OB_ARRAY_OUT_OF_RANGE, ret_value));
|
OZ (helper_.get_int32(is_assoc_array ? OB_READ_NOTHING : OB_ERR_SUBSCRIPT_OUTSIDE_LIMIT, ret_value));
|
||||||
OZ (helper_.create_store(ret_value, ret_value_ptr));
|
OZ (helper_.create_store(ret_value, ret_value_ptr));
|
||||||
OZ (helper_.create_br(exit));
|
OZ (helper_.create_br(exit));
|
||||||
OZ (helper_.set_insert_point(after_block));
|
OZ (helper_.set_insert_point(after_block));
|
||||||
@ -4572,6 +4573,7 @@ int ObPLCodeGenerator::generate_get_attr(ObLLVMValue ¶m_array,
|
|||||||
obj_access.at(i),
|
obj_access.at(i),
|
||||||
i,
|
i,
|
||||||
for_write,
|
for_write,
|
||||||
|
parent_type.is_associative_array_type(),
|
||||||
value,
|
value,
|
||||||
ret_value_ptr,
|
ret_value_ptr,
|
||||||
exit));
|
exit));
|
||||||
|
|||||||
@ -657,6 +657,7 @@ private:
|
|||||||
const ObObjAccessIdx ¤t_access,
|
const ObObjAccessIdx ¤t_access,
|
||||||
int64_t access_i,
|
int64_t access_i,
|
||||||
bool for_write,
|
bool for_write,
|
||||||
|
bool is_assoc_array,
|
||||||
jit::ObLLVMValue ¤t_value,
|
jit::ObLLVMValue ¤t_value,
|
||||||
jit::ObLLVMValue &ret_value_ptr,
|
jit::ObLLVMValue &ret_value_ptr,
|
||||||
jit::ObLLVMBasicBlock& exit);
|
jit::ObLLVMBasicBlock& exit);
|
||||||
|
|||||||
@ -233,8 +233,8 @@ int ObExprObjAccess::ExtraInfo::get_collection_attr(int64_t* params,
|
|||||||
int64_t element_idx;
|
int64_t element_idx;
|
||||||
CK (OB_NOT_NULL(current_coll));
|
CK (OB_NOT_NULL(current_coll));
|
||||||
if (OB_SUCC(ret) && !current_coll->is_inited()) {
|
if (OB_SUCC(ret) && !current_coll->is_inited()) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_ERR_COLLECION_NULL;
|
||||||
LOG_WARN("", K(ret), KPC(current_coll));
|
LOG_WARN("Reference to uninitialized collection", K(ret), KPC(current_coll));
|
||||||
}
|
}
|
||||||
if (OB_SUCC(ret) && !current_access.is_property()) {
|
if (OB_SUCC(ret) && !current_access.is_property()) {
|
||||||
if (current_access.is_const()) {
|
if (current_access.is_const()) {
|
||||||
@ -383,7 +383,7 @@ int ObExprObjAccess::ExtraInfo::calc(ObObj &result,
|
|||||||
OZ (get_attr_func(param_array.count(), param_ptr, &attr_addr, *ctx));
|
OZ (get_attr_func(param_array.count(), param_ptr, &attr_addr, *ctx));
|
||||||
}
|
}
|
||||||
if (OB_FAIL(ret)) {
|
if (OB_FAIL(ret)) {
|
||||||
if (OB_NOT_INIT == ret && pl::ObCollectionType::EXISTS_PROPERTY == property_type_) {
|
if (OB_ERR_COLLECION_NULL == ret && pl::ObCollectionType::EXISTS_PROPERTY == property_type_) {
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
result.set_tinyint(0);
|
result.set_tinyint(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user