8000 Bug fix 3.4/disallow subqueries in prune by jsteemann · Pull Request #10266 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix 3.4/disallow subqueries in prune #10266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
v3.4.9 (XXX-XX-XX)
-------------------

* Disallow the usage of subqueries inside AQL traversal PRUNE conditions.
Using subqueries inside PRUNE conditions causes undefined behavior,
so such queries will now be aborted early on with a parse error
instead of running into undefined behavior.

* Fixed search not working in document view while in code mode.

* Fixed issue #10090: fix repeatable seek to the same document in
Expand Down
17 changes: 17 additions & 0 deletions arangod/Aql/Ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,23 @@ AstNode* Ast::createNodeReference(Variable const* variable) {
return node;
}

/// @brief create an AST subquery reference node
AstNode* Ast::createNodeSubqueryReference(std::string const& variableName) {
AstNode* node = createNode(NODE_TYPE_REFERENCE);
node->setFlag(AstNodeFlagType::FLAG_SUBQUERY_REFERENCE);

auto variable = _scopes.getVariable(variableName);

if (variable == nullptr) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"variable not found in reference AstNode");
}

node->setData(variable);

return node;
}

/// @brief create an AST variable access
AstNode* Ast::createNodeAccess(Variable const* variable,
std::vector<basics::AttributeName> const& field) {
Expand Down
3 changes: 3 additions & 0 deletions arangod/Aql/Ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ class Ast {
/// @brief create an AST reference node
AstNode* createNodeReference(Variable const* variable);

/// @brief create an AST subquery reference node
AstNode* createNodeSubqueryReference(std::string const& variableName);

/// @brief create an AST parameter node for a value literal
AstNode* createNodeParameter(char const* name, size_t length);

Expand Down
1 change: 1 addition & 0 deletions arangod/Aql/AstNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ enum AstNodeFlagType : AstNodeFlagsType {
FLAG_KEEP_VARIABLENAME = 0x0010000, // node is a reference to a variable name, not the variable value (used in KEEP nodes)
FLAG_BIND_PARAMETER = 0x0020000, // node was created from a bind parameter
FLAG_FINALIZED = 0x0040000, // node has been finalized and should not be modified; only set and checked in maintainer mode
FLAG_SUBQUERY_REFERENCE = 0x0080000, // node references a subquery
};

/// @brief enumeration of AST node value types
Expand Down
Loading
0