-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix crash when the expression exceed the depth #3545
Conversation
src/parser/parser.yy
Outdated
if(!$$->checkDepth()){ | ||
throw nebula::GraphParser::syntax_error(@1, "The above expression is not a valid expression, because its depth exceeds the maximum depth!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure is it better to wrap the check as a macro function. Writing the same check and error messages too many times seems not well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -575,112 +581,148 @@ expression | |||
$$ = UnaryExpression::makeNegate(qctx->objPool(), $3); | |||
} | |||
scanner.setUnaryMinus(false); | |||
CHECK_DEPTH($$, @1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expression:
: expression_internal {
if (visitDepth($1)) {}
$$ = $1;
}
;
expression_internal
: constant_expression {
}
...
What type of PR is this?
What does this PR do?
closing #3393
Which issue(s)/PR(s) this PR relates to?
Special notes for your reviewer, ex. impact of this fix, etc:
Additional context/ Design document:
Checklist:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: