This is an automated email from the ASF dual-hosted git repository. yangzhg pushed a commit to branch branch-1.1-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push: new ef646ff3bc [fix](non-vec expr) apply pr #17346 into non-vectorized engine, avoid crashing caused by big depth of expression tree (#18521) ef646ff3bc is described below commit ef646ff3bc21fc1afe55d4c1c390bafcc461be77 Author: camby <zhuxiaol...@baidu.com> AuthorDate: Wed Apr 12 10:36:34 2023 +0800 [fix](non-vec expr) apply pr #17346 into non-vectorized engine, avoid crashing caused by big depth of expression tree (#18521) --- be/src/exprs/expr.cpp | 8 ++++++++ be/src/exprs/expr_context.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/be/src/exprs/expr.cpp b/be/src/exprs/expr.cpp index 4e46829ac8..701fc7c217 100644 --- a/be/src/exprs/expr.cpp +++ b/be/src/exprs/expr.cpp @@ -535,9 +535,17 @@ Status Expr::prepare(const std::vector<ExprContext*>& ctxs, RuntimeState* state, Status Expr::prepare(RuntimeState* state, const RowDescriptor& row_desc, ExprContext* context) { DCHECK(_type.type != INVALID_TYPE); + ++context->_depth_num; + if (context->_depth_num > config::max_depth_of_expr_tree) { + return Status::InternalError( + fmt::format("The depth of the expression tree is too big, make it less than {}", + config::max_depth_of_expr_tree)); + } for (int i = 0; i < _children.size(); ++i) { RETURN_IF_ERROR(_children[i]->prepare(state, row_desc, context)); } + + --context->_depth_num; return Status::OK(); } diff --git a/be/src/exprs/expr_context.h b/be/src/exprs/expr_context.h index cced55dbec..6e9df9a30c 100644 --- a/be/src/exprs/expr_context.h +++ b/be/src/exprs/expr_context.h @@ -186,6 +186,9 @@ private: /// Calls the appropriate Get*Val() function on 'e' and stores the result in result_. /// This is used by Exprs to call GetValue() on a child expr, rather than root_. void* get_value(Expr* e, TupleRow* row); + + /// The depth of expression-tree. + int _depth_num = 0; }; inline void* ExprContext::get_value(TupleRow* row) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org