[GIS] fix expr coredump
This commit is contained in:
@ -152,11 +152,11 @@ int ObExprGeomWkb::eval_geom_wkb(const ObExpr &expr,
|
||||
axis_order))) {
|
||||
LOG_WARN("fail to parse axis order option string", K(ret), K(option_str));
|
||||
ret = OB_ERR_INVALID_OPTION_KEY_VALUE_PAIR; // adapt mysql errcode.
|
||||
const uint64_t STR_LEN_MAX = 512;
|
||||
char err_str[STR_LEN_MAX] = {0};
|
||||
const int64_t len = option_str.length();
|
||||
char str[len + 1];
|
||||
str[len] = '\0';
|
||||
MEMCPY(str, option_str.ptr(), len);
|
||||
LOG_USER_ERROR(OB_ERR_INVALID_OPTION_KEY_VALUE_PAIR, str, '=', get_func_name());
|
||||
MEMCPY(err_str, option_str.ptr(), (len >= STR_LEN_MAX ? (STR_LEN_MAX - 1) : len));
|
||||
LOG_USER_ERROR(OB_ERR_INVALID_OPTION_KEY_VALUE_PAIR, err_str, '=', get_func_name());
|
||||
} else if (OB_FAIL(ObGeoExprUtils::check_need_reverse(axis_order, need_reverse))) {
|
||||
LOG_WARN("fail to check need reverse", K(ret), K(axis_order));
|
||||
}
|
||||
|
||||
@ -64,14 +64,15 @@ int ObExprSTSRID::calc_result_typeN(ObExprResType& type,
|
||||
} else if (!ob_is_geometry(types_stack[0].get_type()) && !ob_is_string_type(types_stack[0].get_type())) {
|
||||
ret = OB_ERR_GIS_INVALID_DATA;
|
||||
LOG_USER_ERROR(OB_ERR_GIS_INVALID_DATA, get_name());
|
||||
} else {
|
||||
type.set_int32();
|
||||
}
|
||||
if (OB_SUCC(ret) && param_num > 1) {
|
||||
types_stack[1].set_calc_type(ObIntType);
|
||||
type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_STRING_INTEGER_TRUNC);
|
||||
type.set_geometry();
|
||||
type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObGeometryType]).get_length());
|
||||
if (OB_SUCC(ret)) {
|
||||
type.set_int32();
|
||||
if (param_num > 1) {
|
||||
types_stack[1].set_calc_type(ObIntType);
|
||||
type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_STRING_INTEGER_TRUNC);
|
||||
type.set_geometry();
|
||||
type.set_length((ObAccuracy::DDL_DEFAULT_ACCURACY[ObGeometryType]).get_length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1149,3 +1149,5 @@ select _st_asewkb(x'000000000105000000030000000102000000020000000000000000002440
|
||||
ERROR 22023: Invalid GIS data provided to function _st_asewkb.
|
||||
select st_asbinary(x'000000000104000000060000000101000000000000000000244000000000000014400102000000020000000000000000002E400000000000002E400000000000003440000000000000344001030000000100000004000000000000000000F03F00000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000F03F000000000000000001040000000200000001010000000000000000000000000000000000000001010000000000000000003440000000000000344001050000000200000001020000000200000000000000000014400000000000002440000000000000144000000000000034400102000000020000000000000000002E4000000000000024400000000000003E400000000000002E4001060000000200000001030000000100000005000000000000000000F03F0000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F03F000000000000000001030000000100000005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001440');
|
||||
ERROR 22023: Invalid GIS data provided to function st_asbinary.
|
||||
SELECT ST_ASWKB(POINT(0,0), REPEAT('{"a"', 100000));
|
||||
ERROR 22023: The string '{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"{"a"' is not a valid key = value pair in function st_aswkb.
|
||||
|
||||
@ -152,3 +152,8 @@ bugfix: 53257405
|
||||
select st_srid(st_geomfromtext('point(100 100)')) - 3;
|
||||
st_srid(st_geomfromtext('point(100 100)')) - 3
|
||||
-3
|
||||
select weight_string(st_srid(NULL));
|
||||
weight_string(st_srid(NULL))
|
||||
NULL
|
||||
select weight_string(st_srid(3333));
|
||||
ERROR 22023: Invalid GIS data provided to function st_srid.
|
||||
|
||||
@ -696,3 +696,5 @@ select _st_asewkb(x'000000000105000000030000000102000000020000000000000000002440
|
||||
# bugfix:
|
||||
--error 3037
|
||||
select st_asbinary(x'000000000104000000060000000101000000000000000000244000000000000014400102000000020000000000000000002E400000000000002E400000000000003440000000000000344001030000000100000004000000000000000000F03F00000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000F03F000000000000000001040000000200000001010000000000000000000000000000000000000001010000000000000000003440000000000000344001050000000200000001020000000200000000000000000014400000000000002440000000000000144000000000000034400102000000020000000000000000002E4000000000000024400000000000003E400000000000002E4001060000000200000001030000000100000005000000000000000000F03F0000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440000000000000F03F000000000000000001030000000100000005000000000000000000184000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C4000000000000018400000000000001440');
|
||||
--error 3560
|
||||
SELECT ST_ASWKB(POINT(0,0), REPEAT('{"a"', 100000));
|
||||
@ -119,4 +119,8 @@ SELECT _ST_SETSRID(ST_GEOMFROMTEXT('POINT'),NULL);
|
||||
select st_astext(st_srid(x'0000000001030000000300000005000000000010000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000005000000000000000000144000000000000014400000000000001C4000000000000014400000000000001C400000000000001C4000000000000014400000000000001C40000000000000144000000000000014410500000000000000000014C000000000000014C00000000000001CC000000000000014C00000000000001CC00000000000001CC000000000000014C00000000000001CC000000000000014C000000000000014C0',0));
|
||||
|
||||
--echo bugfix: 53257405
|
||||
select st_srid(st_geomfromtext('point(100 100)')) - 3;
|
||||
select st_srid(st_geomfromtext('point(100 100)')) - 3;
|
||||
|
||||
select weight_string(st_srid(NULL));
|
||||
--error 3037
|
||||
select weight_string(st_srid(3333));
|
||||
Reference in New Issue
Block a user