From 875865e081eb7bb05585d734480f3a8f2e4464e4 Mon Sep 17 00:00:00 2001 From: lf0 Date: Fri, 17 Sep 2021 19:09:35 +0800 Subject: [PATCH] Fix traverse does not check overflow resulting in stack overflow --- src/sql/plan_cache/ob_ps_sql_utils.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sql/plan_cache/ob_ps_sql_utils.cpp b/src/sql/plan_cache/ob_ps_sql_utils.cpp index 06c4decafe..dd6f7037ef 100644 --- a/src/sql/plan_cache/ob_ps_sql_utils.cpp +++ b/src/sql/plan_cache/ob_ps_sql_utils.cpp @@ -62,8 +62,16 @@ int ObPsSqlParamHelper::traverse( TraverseContext& ctx, ObIArray& no_check_type_offsets, ObIArray& not_param_offsets) { int ret = OB_SUCCESS; - if (OB_ISNULL(ctx.node_)) { - // ignore + bool is_overflow = false; + if (OB_FAIL(check_stack_overflow(is_overflow))) { + LOG_WARN("failed to check stack overflow", K(ret)); + } else if (is_overflow) { + ret = OB_SIZE_OVERFLOW; + LOG_WARN("too deep recusive", K(ret)); + } + if (OB_FAIL(ret)) { + } else if (OB_ISNULL(ctx.node_)) { + //ignore } else { bool is_set = false; const ParseNode& parent = *ctx.node_; -- GitLab