From 126145a7eca2c054367abc65291ab1c90c51b998 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Mon, 4 Mar 2019 16:06:14 +0800 Subject: core: vm: sqlvm: limit the depth of AST to 1024 Since we traverse an AST by calling functions recursively, we have to protect the parser by limiting the depth of an AST. --- core/vm/sqlvm/ast/constants.go | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 core/vm/sqlvm/ast/constants.go (limited to 'core/vm/sqlvm/ast') diff --git a/core/vm/sqlvm/ast/constants.go b/core/vm/sqlvm/ast/constants.go new file mode 100644 index 000000000..a11a182ea --- /dev/null +++ b/core/vm/sqlvm/ast/constants.go @@ -0,0 +1,5 @@ +package ast + +// DepthLimit is the limit of AST depth used to prevent exhausting the stack +// when traversing the tree recursively. +const DepthLimit = 1024 -- cgit v1.2.3