fix st_distance stack overflow

This commit is contained in:
obdev 2023-07-19 08:12:18 +00:00 committed by ob-robot
parent 6379e3724a
commit bcf3d94b1d
2 changed files with 4 additions and 5 deletions

View File

@ -125,7 +125,6 @@ private:
{
INIT_SUCC(ret);
common::ObIAllocator *allocator = context.get_allocator();
typename CollectonType::iterator iter;
double min_dist = std::numeric_limits<double>::infinity();
double temp_res = min_dist;
@ -134,7 +133,7 @@ private:
LOG_WARN("Null allocator", K(ret));
} else if (g1->type() == ObGeoType::GEOMETRYCOLLECTION) {
const CollectonType *geo1 = reinterpret_cast<const CollectonType *>(g1->val());
iter = geo1->begin();
typename CollectonType::iterator iter = geo1->begin();
for (; iter != geo1->end() && OB_SUCC(ret); iter++) {
typename CollectonType::const_pointer sub_ptr = iter.operator->();
ObGeoType sub_type = geo1->get_sub_type(sub_ptr);
@ -155,7 +154,7 @@ private:
}
} else if (g2->type() == ObGeoType::GEOMETRYCOLLECTION) {
const CollectonType *geo2 = reinterpret_cast<const CollectonType *>(g2->val());
iter = geo2->begin();
typename CollectonType::iterator iter = geo2->begin();
for (; iter != geo2->end() && OB_SUCC(ret); iter++) {
typename CollectonType::const_pointer sub_ptr = iter.operator->();
ObGeoType sub_type = geo2->get_sub_type(sub_ptr);

View File

@ -188,10 +188,8 @@ int ObExprSTDistance::eval_st_distance(const ObExpr &expr, ObEvalCtx &ctx, ObDat
int ret = OB_SUCCESS;
ObDatum *gis_datum1 = NULL;
ObDatum *gis_datum2 = NULL;
ObDatum *gis_unit = NULL;
ObExpr *gis_arg1 = expr.args_[0];
ObExpr *gis_arg2 = expr.args_[1];
const int max_arg_num = 3;
ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx);
common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator();
@ -250,7 +248,9 @@ int ObExprSTDistance::eval_st_distance(const ObExpr &expr, ObEvalCtx &ctx, ObDat
ObGeoExprUtils::geo_func_error_handle(ret, N_ST_DISTANCE);
}
} else {
const int max_arg_num = 3;
if (expr.arg_cnt_ == max_arg_num) {
ObDatum *gis_unit = NULL;
double factor = 0.0;
if (OB_FAIL(expr.args_[max_arg_num - 1]->eval(ctx, gis_unit))) {
LOG_WARN("eval geo unit arg failed", K(ret));