[CP] fix core at pl parser vsnprintf

This commit is contained in:
obdev 2022-11-29 12:09:25 +00:00 committed by ob-robot
parent d216cebd66
commit b556f241b3

View File

@ -206,4 +206,23 @@ extern const NonReservedKeyword *mysql_pl_non_reserved_keyword_lookup(const char
// e.g., (int64_t)3.00000000000000001 == 3.00000000000000001 is true;
// oracle supports up to 40 decimal place precision.
#define ESCAPE_PERCENT_CHARACTER(result, src, dst)\
do {\
if (OB_NOT_NULL(result) && OB_NOT_NULL(src)) {\
int64_t src_len = strlen(src);\
int64_t dst_len = 2 * src_len + 1;\
int64_t pos = 0;\
dst = (char *)parse_malloc(dst_len, result->mem_pool_);\
if (OB_LIKELY(NULL != dst)) {\
for (int64_t i = 0; i < src_len; i++) {\
if (src[i] == '%') {\
dst[pos++] = '%';\
}\
dst[pos++] = src[i];\
}\
dst[pos] = 0;\
}\
}\
} while (0)
#endif /* OCEANBASE_SRC_PL_PARSER_PL_PARSER_BASE_H_ */